On Fri, 20 Aug 1999, Bob Howard wrote: > data Tree a = Leaf a | Branch (Tree a) (Tree a) > Branch :: Tree a -> Tree a -> Tree a > Leaf :: a -> Tree a > > Im just learning haskell and I cant seem to figure out what is wrong with the above >code. > Im using Hugs98 as in interperator (sp) and I keep getting the following Error when >I read the file. > > ERROR "Tree.hs" (line 2): Syntax error in declaration (unexpected `::') In haskell there's a policy that functions and bindings (the x in f x =...) must begin with a lowercase letter whilst type names (Tree) and constructors (Branch) must begin with capital letters. Your Branch there is a function and hence needs to be called branch. (Although the error message is bewildering if you don't know what's going on, the :: is the first place an error is detected because it's also legal in Haskell to define infix operators, so your line 2 is initially interpreted as the start of something like Branch x +o+ Branch y = .... ) ___cheers,_dave______________________________________________________ email: [EMAIL PROTECTED] "He'd stay up all night inventing an www.cs.bris.ac.uk/~tweed/pi.htm alarm clock to ensure he woke early work tel: (0117) 954-5253 the next morning"-- Terry Pratchett