Frank Atanassow writes:
> Using <- in type signatures has the advantage that the first thing you see in
> a signature is what is produced, rather than what is necessary to produce,
> which is sometimes what you want when you have a set of algebraic functions
> like John Hughes' pretty-printing library:
>
> text :: Doc <- String
> (<+>) :: Doc <- Doc <- Doc
On re-reading this I see my point was not so clear. What I wanted to indicate
is that the functions of an algebra have a common codomain, like Doc, so
putting it first in a signature emphasizes the commonality between
them. Combinator languages and monads (the extra operations are generally
typed as X -> M Y, for a monad M) are pretty common in Haskell, so by that
token (<-) might be preferable to (->).
OTOH, if we used coalgebras more heavily in Haskell we could make the opposite
case, that (->) is preferable, since coalgebras have a common domain.
--
Frank Atanassow, Dept. of Computer Science, Utrecht University
Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands
Tel +31 (030) 253-1012, Fax +31 (030) 251-3791