[Hat] Strange hat-trans error

Malcolm Wallace hat@haskell.org
Mon, 14 Oct 2002 16:32:43 +0100


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