[Haskell-cafe] type refinement to a typeclass constrained type

Daniil Elovkov daniil.elovkov at googlemail.com
Fri Mar 23 05:45:19 EDT 2007


Ok,
btw, this works :)

data Cnd c where
    In :: (Eq (c a)) => c a -> [c a] -> Cnd c

check :: (Eq (c a)) => Cnd c -> Bool
check (x `In` items) = x `elem` items

That's nice :)

2007/3/23, Simon Peyton-Jones <simonpj at microsoft.com>:
> | Interesting thing though, it's the same on 6.4.1.
> |
> | Wasn't this brokenness introduced in 6.6, but rather has lingered in
> | ghc for a while, or since the introduction of GADTs, at all?
>
> No it's always been broken.  I finally made GADTs and type classes work together in the HEAD a few months ago, using implication constraints for the first time.
>
>


More information about the Haskell-Cafe mailing list