patch applied (haskell-prime-status): add ""Make $ left associative, like application"

apfelmus apfelmus at quantentunnel.de
Wed Apr 23 07:41:35 EDT 2008


Dan Doel wrote:
> 3) Left associative ($) is consistent with left associative ($!).
>
>    (f $! x) y z
>    ((f $! x) $! y) $! z
> 
> Left associative, these are:
> 
>    f $! x $ y $ z
>    f $! x $! y $! z

Nice! Subconsciously, the fact that ($!) is currently not left 
associative has always bitten me.


In the light of Cale's plan to make (.) equivalent to  fmap , there is 
also the option to redefine ($) to mean  fmap  . This would eliminate 
the need for a special <$> for applicative functors.

Note that setting (.) or ($) = fmap  subsumes function application, 
because we have

   fmap :: (a -> b) -> a -> b

for the /identity functor/. In other words, the current ($) and (.) are 
just special cases of the general  fmap  . Unfortunately, the identity 
functor currently can't be overloaded, although I think it would be 
unambiguous.


Regards,
apfelmus



More information about the Haskell-prime mailing list