[Haskell-cafe] Type synonyms considered harmful?

Julian Ospald hasufell at posteo.de
Sat Jan 17 19:06:16 UTC 2015


Hi,

I've recently had a discussion about type synonyms and when to use them
in haskell.

On the one hand, they make reading type signatures easier and tell you
what is meant, not just what is inside. On the other hand they also sort
of hide what is inside, although you will probably need to know exactly
that when using them. This might make reading code for new collaborators
more difficult if they have to memorize all type synonyms first.

So there are basically a few questions:
* What do you think is a good policy for when and how to use them? Or
would you say just not use them at all and put equivalent information in
parameter documentation?
* What are the upsides, downsides, pitfalls and also alternatives? (for
completeness, also since
https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse)
* Can we do something to improve the downsides? Or is there already
something? (e.g. editor/IDE that can tell me the underlying type, error
messages etc.)


--
Regards,
Julian Ospald


More information about the Haskell-Cafe mailing list