
12 Apr
2011
12 Apr
'11
3:04 p.m.
I am trying as an experiment to write something as follows: data Wrapper a b where Pure :: (a -> b) -> Wrapper a b Nullable :: (Maybe a -> b) -> Wrapper a b class Liftable a b where liftTo :: (b -> c) -> a b c instance Liftable Wrapper a where liftTo = Pure instance Liftable Wrapper (Maybe a) where liftTo = Nullable Obviously this code (with suitable extensions enabled) complains of overlapping type instances, but is there a way to accomplish redefining a class instance for one particular group of types while having it defined for all others? (Maybe a vs. a in this instance) -- Edward Amsden Student Computer Science Rochester Institute of Technology www.edwardamsden.com