[Haskell-beginners] Structural restrictions in type constructor

Imants Cekusins imantc at gmail.com
Tue Jun 23 20:14:52 UTC 2015


> alter its Eq => definition

module MatchTuple (MyP) where

data MyP t = MyP(t,t) deriving Show
instance Eq t => Eq (MyP t)  where
   (==) = match


match::Eq t =>  MyP t-> MyP t -> Bool
match (MyP(x1,x2)) (MyP(x3,x4))
   | x1 == x3 &&  x2 == x4 = True
   | x1 == x4 &&  x2 == x3 = True
   | otherwise = False


?


More information about the Beginners mailing list