
You need -fglasgow-exts. (Should ignore a pragma without -fglasgow-exts, and does so now, but 5.03 gave the bad message you found.) The manual is wrong; spaces between the variables is right. Simon | -----Original Message----- | From: Janis Voigtlaender [mailto:voigt@orchid.inf.tu-dresden.de] | Sent: 16 May 2002 14:49 | To: glasgow-haskell-users@haskell.org | Subject: syntax of RULES pragmas? | | | Hi, | | I was trying to play with GHC 5.02's RULES pragmas, but | failed due to syntax problems. | | When trying: | | {-# RULES "map/map" forall f g xs. map f (map g xs) = map | (f.g) xs #-} | | main = print (map id (map id "Hello")) | | I get: | | ghc5 test.hs -O | test.hs:1: Variable not in scope: `forall' | | test.hs:1: Variable not in scope: `f' | | test.hs:1: Variable not in scope: `g' | | test.hs:1: Variable not in scope: `xs' | | test.hs:1: Variable not in scope: `f' | | test.hs:1: Variable not in scope: `g' | | test.hs:1: Variable not in scope: `xs' | | test.hs:1: Variable not in scope: `f' | | test.hs:1: Variable not in scope: `g' | | test.hs:1: Variable not in scope: `xs' | Exit 1 | | | With: | | {-# RULES "map/map" forall f g xs. | map f (map g xs) = map (f.g) xs #-} | | main = print (map id (map id "Hello")) | | I get: | | test.hs:2: parse error (possibly incorrect indentation) | Exit 1 | | | In the user's doc on http://www.haskell.org/ghc/ I also saw | the syntax: | | {-# RULES "map/map" forall f,g,xs. map f (map g xs) = map | (f.g) xs #-} | | main = print (map id (map id "Hello")) | | which fails with: | | test.hs:1: parse error on input `,' | Exit 1 | | | So how exactly do I have to specify a rewrite rule? Any hints | appreciated. | | Thanks, Janis. | | | -- | Janis Voigtlaender | http://wwwtcs.inf.tu-dresden.de/~voigt/ | mailto:voigt@tcs.inf.tu-dresden.de | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users |
participants (1)
-
Simon Peyton-Jones