functional dependency problem

Christian Maeder maeder@Informatik.Uni-Bremen.DE
Tue, 09 Jul 2002 17:37:44 +0200

Simon Peyton-Jones wrote:
> | info :: (Collects e ce, Show e) => ce -> String
> | info v = show ((one v) ::e)
> As the error message says, and as the Haskell report says,
> this means
>   info v = show ((one v) :: (forall e.e))
> which is not what you meant.  

Ok, I did not know that I have to mention a type variable in the pattern
on the lhs in order to use it monomorphically on the rhs, like in:

    info (v :: ce) = show (one (v :: ce))

Still, I would like to get "e" as a monomorphic type from the functional
dependency "ce -> e" in class Collects, maybe as a language extension in
the form of:
    info (v :: ce | ce -> e) = show ((one v) :: e)

Cheers Christian