[Haskell] Proposal: unification of style of function/data/type/class definitions

Neil Mitchell ndmitchell at gmail.com
Sun Sep 10 06:21:50 EDT 2006


Hi,

> class Monad m | Functor m, Monoid m where ...

Nice - I was having exactly this problem in Hoogle, if you list all
the class dependancies first, you can't really see the actual class.
It also makes grep'ing easier.

> data EncodedStream m h | Monad m, Stream m h = ...

Ditto

> sequence :: [m a] -> m [a] | Monad m

I don't like this. In the other two instances you are moving the most
important information (the name of the thing) to the front. In this
the name is at the front, but the instances move to the end, which
isn't really where they should be. And following the function | rule

function | predicates = body

I would have said that logically, you want:

sequence | Monad m :: [m a] -> m [a]

(of course, this might present a problem for parsing...)

Note this also makes sense compared to your:

data Data | Classes = Alternatives

design as well

Thanks

Neil


More information about the Haskell mailing list