Jan-Willem Maessen wrote:
] Is it really clear or obvious what
] 
] > map . (+)
]
] means? 

Perhaps the following two examples might be more convincing:

> u=uncurry
> e=((partition $ u(==)).) . zip
> f x=(x\\).(x\\)

It is obviously clear what 'e' and 'f x' do.

The second example, which even contains the type signature to increase
comprehension:

> prod:: (MCompose a b (c -> d) e, MCompose f g (b,g) d) =>
>        (h -> a) -> (c -> f) -> h -> e
>
> prod = (. ((. (,)) . mcomp)) . mcomp

Here `prod' is indeed the categorical product. The second example is
taken from
        http://pobox.com/~oleg/ftp/Haskell/categorical-maxn.lhs
which has the following comment about that code fragment:

  The constraints in the prod's type are intricately related. The final
  expression for prod bears some similarity with Unlambda code. Perhaps
  because both Unlambda and the category theory eschew "elements" in
  favor of combinations of arrows. Probably there are other
  similarities.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to