Hugs (version februari 2000) keeps reporting unexpected ';' or
unexpected '}' in files that don't even contain those characters. I know
very little about Haskell (I just started to try and study the language)
so my haskell files will probably not be correct. Still with this kind
of messages I have no clue of what to change in my programs. I don't
know if this is a bug, or something I'm doing wrong.
I'm using a Linux2.2 operating system on an i386 processor.
I attached a haskell source file (which is probably not even good
haskell syntax), and the unexpected error message reported by hugs. The
latter file was created typing:
hugs tree.hs > hugserror.txt
Thank you,
Philippe Faes
mailto:[EMAIL PROTECTED]
__ __ __ __ ____ ___ _________________________________________
|| || || || || || ||__ Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__|| __|| Copyright (c) 1994-1999
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| || Report bugs to: [EMAIL PROTECTED]
|| || Version: February 2000 _________________________________________
Haskell 98 mode: Restart with command line option -98 to enable extensions
Reading file "/usr/local/share/hugs/lib/Prelude.hs":
Parsing Dependency analysis
Type checking Compiling
Reading file "tree.hs":
Parsing
ERROR "tree.hs" (line 16): Syntax error in data type definition (unexpected `;',
possibly due to bad layout)
Prelude> [Leaving Hugs]
-- haskell
-- poging tot implementeren van trees en optimal search tree
-- *** tree.hs ***
-- cf cursus G&S p430
-- nieuwe types
type Weight = Float
type Cost = Float
type Failweight = Weight
type Token = Char
-- datastucturen
data Tree = Failnode Weight | Branch Token Tree Tree
data Lijst = [Lijstelem]
data Lijstelem = Le Weight Failweight
-- functies
q :: Int -> Lijst -> Weight
q 0 (Lelm _ fw):ls = fw
q i l:ls | i>0 = q i-1 ls
| i<0 = error "fout in q"
p :: Int -> Lijst -> Weight
c :: Int -> Int -> Lijst -> Weight
c i i _ = 0
c i j l = (w i j l) + zoekmin
w :: Int -> Int -> Lijst -> Weight
w 0 0 [] = error "fout in lijstbewerking in tree.hs"
w i i l = q i
w i j l = (w i j-1 l) + (q j) +(p j)
-- er wordt niet gecontroleerd of i>j; dat zou een fout moeten opleveren
zoekmin :: Int -> Int -> Lijst -> Weight
zoekmin i j l = (c i (zoekroot-1 l) l) + (c (zoekroot l) j l)
zookroot :: Int -> Int -> Lijst -> Int
--moet nog geimplementeerd worden
optboom :: Int -> Int -> Lijst -> Tree
optboom i i l = Failnode (q i)
optboom i j l = Branch (optboom i zoekroot) (zoekroot) (optboom (zoekroot+1) j)
-- deze syntax klopt niet