[Haskell-cafe] Type synonyms vs standard types

Michael Snoyman michael at snoyman.com
Tue Sep 29 14:36:13 EDT 2009

On Tue, Sep 29, 2009 at 7:40 PM, Olex P <hoknamahn at gmail.com> wrote:

> Hi everyone,
> Dumb question about declaring a function and type synonyms.
> There are to different declarations of the same function:
> attrNames :: String -> AttrDict -> [String]
> attrNames :: AttrClass -> AttrDict -> AttrNames
> First gives you the idea about exact types it expects (except AttrDict for
> which user has to take a look into the docs or sources) while the second one
> gives you the idea about meaning of parameters.
> Both reasons make sense. The question is when which one should be used? I'm
> using type synonyms everywhere and possibly without too much reasons...
> Maybe I should stop doing it? :)
I like type synonyms. You can always look up what the type synonym boils
down to, while the reverse cannot be done. Of course, some Haddock markup
can also solve the problem.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090929/0335ca46/attachment.html

More information about the Haskell-Cafe mailing list