Hello,
Does the following code work for you?
-Jeff
---------------------------
{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances
-fallow-overlapping-instances #-}
data Nil = Nil
data x ::: xs = x ::: xs
infixr 5 :::
data HTrue = HTrue deriving Show
data HFalse = HFalse deriving Show
class Member x xs b | x xs -> b where member :: x -> xs -> b
instance Member x Nil HFalse where member _ _ = HFalse
instance Member x xs b => Member x (x ::: xs) HTrue where member _ _ =
HTrue
instance Member x xs b => Member x (y ::: xs) b where member x (_ ::: xs)
= member x xs
{-
member 'a' (() ::: "a" ::: '1' ::: Nil) ==> HTrue
member 'a' (() ::: "a" ::: Nil) ==> HFalse
-}
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe