[Haskell-cafe] Type family oddity

Florian Weimer fw at deneb.enyo.de
Sun Oct 5 06:43:05 EDT 2008


* Claus Reinke:

>> -- erase_range :: (Sequence s) => RangeTrait s -> IO (RangeTrait s)
>
> This can't work, as you can see after desugaring:
>
>> -- erase_range :: (Sequence s,RangeTrait s~rs) => rs -> IO rs
>
> There is nowhere to get 's' from, unless you start applying type families
> backwards, from results to parameters.

Thanks.  Indeed, this is a bug in my reading of the specification (and
the original even had that Sequence argument).  I was led astray by the
fact that the type checker accepted the class declaration, even though
there's no really good way to provide a concrete implementation.

Another example I encountered is this:

class Foo f where
    foo :: f -> g -- oops, typo

It was very difficult for me to spot this one, too. 8-/


More information about the Haskell-Cafe mailing list