
Hi, I'm using hat 2.00 with hmake 3.06 and ghc 5.02.3 and get a strange compilation error on the following (admittedly obscure) function: map_fst3:: (a->a) -> ((a,b,c) ->d-> (a,b,c)) ->(a,b,c) -> d -> (a,b,c) (f `map_fst3`g) (a,b,c) d = (f a', b', c') where (a',b',c') = g (a,b,c) d The error is:
>>>>>>>>>>>>> hat-trans foo.hs
Fail: Need infix operator at 131:18 <<<<<<<<<<<<<<<<<<< Line 131 would be the 2nd of this 3-line example. Why does hat-trans want an infix operator there? Can someone shed any light on this? ;) Thanks, Nils -- Nils Ellmenreich, Lst. f. Programmierung, Universitaet Passau, Germany

Nils@InfoSun.FMI.Uni-Passau.De (Nils Ellmenreich) writes:
map_fst3:: (a->a) -> ((a,b,c) ->d-> (a,b,c)) ->(a,b,c) -> d -> (a,b,c) (f `map_fst3`g) (a,b,c) d = (f a', b', c') where (a',b',c') = g (a,b,c) d
Fail: Need infix operator at 131:18
Why does hat-trans want an infix operator there?
This is actual a small fault in the hat-trans parser with respect to the Haskell'98 standard. It is not able to parse the parenthesised infix declaration style, that is, (a `f` b) c = ... At the moment, it only accepts infix declarations with exactly two arguments and no parentheses, e.g. a `f` b = ... For higher arities, I'm afraid you need to declare the function non-infix, e.g. f a b c = ... This only applies to declarations - you can continue to apply any function in infix style at any arity >2 as normal. Regards, Malcolm
participants (2)
-
Malcolm Wallace
-
Nils@InfoSun.FMI.Uni-Passau.De