Jonathon Bell jbell@mathsoft.com writes:
i'm tinkering with the Feb 2001 release of hugs, and came across the following problem while attempting to create my own prelude:
module MyPrelude where
import Prelude((:))
hd(x:xs) = x ...
The compiler complains of a syntax error occuring in the import
declaration:
(unexpected symbol ":"). I may well be mistaken since i am somewhat new to haskell programming, but it seems to me that i ought to be able to explicitly import the list type constructor just like any other identifier
No, the cons operator has special status in H98 (in earlier version of Haskell, this wasn't the case); it is considered to be part of the syntax for lists, just like [] and [x1,x2] is. See the discussion of reservedops in Section 2.4 of the report. hth --sigbjorn
participants (1)
-
Sigbjorn Finne