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

Cale Gibbard cgibbard at gmail.com
Wed Apr 23 12:06:42 EDT 2008


2008/4/23 apfelmus <apfelmus at quantentunnel.de>:
> Dan Doel wrote:
>
>  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.
>

Unfortunately, it would be quite ambiguous -- the identity functor
overlaps with basically any other. Consider the case:

    reverse . [[1,2,3],[4,5]]

which if (.) is fmap would normally mean [[3,2,1],[5,4]], but if the
identity functor is used instead would mean [[4,5],[1,2,3]].

  - Cale


More information about the Haskell-prime mailing list