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

Daniil Elovkov daniil.elovkov at googlemail.com
Fri Mar 23 05:47:16 EDT 2007


2007/3/23, Daniil Elovkov <daniil.elovkov at googlemail.com>:
> 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

Eq constraint isn't even needed here, obviously

> check (x `In` items) = x `elem` items


More information about the Haskell-Cafe mailing list