[Haskell-cafe] newbe question

Wolfgang Jeltsch wolfgang at jeltsch.net
Tue Sep 27 09:36:47 EDT 2005


Am Dienstag, 27. September 2005 11:34 schrieb feucht at uni-koblenz.de:
> Hi
> i can not load program test1 into hugs, but test2 works.
> Am i missing some special syntax?
>
> greetings,
> Philip
>
> -------------- test1 ------------------
>
> foo :: Maybe Int -> Int
> foo Nothing =-1
> foo (Just a)= a
>
> -------------- test2 ------------------
>
> foo :: Maybe Int -> Int
> foo Nothing = -1
> --           ^
> --           +-- note an extra space
> foo (Just a)= a

Hello,

obviously, Hugs thinks that =- is a special operator.  In Haskell you have the 
ability to define your own operators, so it would be possible to define an 
operator =-.  I would suggest that you always put spaces around the = in 
declarations.

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list