On 23 June 2010 13:46, Evan Laforge <qdun...@gmail.com> wrote:
> I have a parameterized data type:
>
>> data Val result = VNum Double | VThunk (SomeMonad result)
>> type Environ result = Map Symbol (Val result)
>
> I have a class to make it easier to typecheck Vals:
>
>> class Typecheck a where
>>   from_val :: Val result -> Maybe a

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".

SPJ's paper on type families has this situation arising in the section
on defining a graph class.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to