[Haskell-beginners] Re: map question
Will Ness
will_n48 at yahoo.com
Sun Oct 18 16:57:38 EDT 2009
Daniel Fischer <daniel.is.fischer <at> web.de> writes:
> Am Sonntag 18 Oktober 2009 13:11:07 schrieb Will Ness:
> > (2`mod`) is a unary operation :: (Integral a) => a -> a. Putting it inside
> > backticks would require it be a binary infix op, causing a type mis-match.
>
> instance (Integral a) => Integral (b -> a) where ...
>
> Evil, yes, but then f `(2 `mod`)` x would type-check.
Any problem that could be introduced for operators could be introduced for the
regular named values as well.
>
> But anyway, there are operators where a backticked section would type-check:
>
> f `(g `.`)` x
>
> That's not good.
Why? Is it not just (g .) f x ? What's the problem with it?
But, the backticked parens syntax is less necessary. What I'd really like is
for (`+`1) syntax to become legal.
Prelude> :t let add=(+) in (`add`2)
let add=(+) in (`add`2) :: (Num a) => a -> a
Are we not supposed to be able to substitute equal for equal in Haskell?
Prelude> :t (`(+)`2)
<interactive>:1:2: parse error on input `('
Prelude> :t (`+`2)
<interactive>:1:2: parse error on input `+'
More information about the Beginners
mailing list