Re: Strange hat-trans error

Malcolm Wallace <[email protected]>
Newsgroups gmane.comp.lang.haskell.hat
Organization Dept of Computer Science, University of York, UK.
Message-ID <[email protected]>
[email protected] (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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.