[Haskell] Type problem

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Dec 13 04:42:15 EST 2005


On Tue, Dec 13, 2005 at 09:46:31AM +0100, Emil Axelsson wrote:
> Is this just a limitation of the current GATDs, or is it unreasonable of me 
> to expect this to work?

AFAIK it is a current limitation of GADTs, which will be removed in GHC
6.6.

> Is there any workaround, such as coercing the type of the value function?

I've had the same problem myself. The workaround is to replace some of
type-class constraints with "witness" GADTs. The code I attached
shows how you can do it. I chose to make HasX a GADT, and introduce
the HasX' type-class, but the latter is only for convenience. Note
the subtle change in Val's definition:

data Val a where
   ...
   X :: HasX a -> Val a  -- Unconstrained
               ^^

Best regards
Tomasz

-- 
I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: E.hs
Type: text/x-haskell
Size: 697 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20051213/7326a485/E-0001.bin


More information about the Haskell mailing list