
22 Jun
2015
22 Jun
'15
7:34 a.m.
But this is checking the values in the implementation, not a type level build time guarantee, isn't it? M Imants Cekusins:
we could use pattern matched constructor:
module PairsMatched where
data MyP t = MyP (t,t)(t,t) deriving Show
myP_ctor:: Eq t => (t,t)->(t,t)->MyP t myP_ctor (a1,a2) (a3,a4) | a1 == a4 && a2 == a3 = MyP (a1,a2) (a3,a4) | otherwise = error "mismatched pairs" _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners