[Haskell-cafe] checking types with type families

Evan Laforge qdunkan at gmail.com
Wed Jun 23 03:59:23 EDT 2010


> I'm interested in situations where you think fundeps work and type families don't.  Reason: no one knows how to make fundeps work cleanly with local type constraints (such as GADTs).
>
> If you think you have such as case, do send me a test case.

Well, from looking at the documentation, it looks like I could maybe
use a type family if I could write:

class (DerivedOf a ~ derived) => Typecheck a derived where
 ...

Presumably then I could combine functions 'Typecheck a derived'
constraints without getting lots of "Could not deduce (Typecheck a
derived3) from the context (Typecheck a derived13)" errors.  I'm only
guessing though, because it looks like it's not implemented yet as of
6.12.3.

So is your question whether I have a use case for fundeps supposing
equality constraints in superclass contexts were implemented and they
do what I hope they do, or is it do I have a use for those equality
constraints as a motivation to implement them?

In either case, I can give you some code that works with mptc+fundep
but not with type families, unless I'm not using type families
correctly of course.  But if the type equality thing is coming
regardless, then I can just wait for 6.14 or whatever and switch over
then.


More information about the Haskell-Cafe mailing list