[Haskell-cafe] Restrict values in type

Simon Yarde simonyarde at me.com
Fri Jan 17 10:39:55 UTC 2014


If it's not been mentioned, this tutorial regarding Type Families and the kinds of restrictions you mention might provide a few pointers:

https://www.fpcomplete.com/school/to-infinity-and-beyond/pick-of-the-week/type-families-and-pokemon

In general, I've found key concepts to hold in mind are 'exclusion of bad programs' mentioned in the paper Fun With Types:

http://research.microsoft.com/en-us/um/people/simonpj/papers/assoc-types/fun-with-type-funs/typefun.pdf

I'm sorry if any of this has been mentioned previous.

I asked a related question yesterday about the relative merits of creating type restrictions using using newtypes (unions), which I agree seem unwieldy, and using multi-parameter-type-classes (and/or type families) to enable exclusion-of-bad-programms via instances.  I'd be interested to follow along and see what you discover.


Simon Yarde





More information about the Haskell-Cafe mailing list