[Haskell-cafe] checking types with type families

Evan Laforge qdunkan at gmail.com
Wed Jun 23 02:12:41 EDT 2010


> I think your problem here is that there's no mention of `a' on the
> left-hand size of from_val's type signature; you either need to use
> MPTC+fundep to associate what result is compared to a, or else use a
> phantom type parameter of Val to make it "data Val result a = ..." and
> then "from_val :: Val result a -> Maybe a".

Aha!  Why didn't I think of "plain" old MPTC+fundep?  For some reason
type families feel a lot more fun.  Turns out you can write 'instance
Typecheck (SomeMonad result) result' and instead of complaining about
a duplicate symbol it unifies 'result', exactly like I wanted.

It appears to work like a charm, thanks so much!  Though it says it
fails the Coverage Condition and I need UndecidableInstances...


More information about the Haskell-Cafe mailing list