Often when I define some type that wraps something else, I find myself writing a function like the following:
newtype Thing = Thing X liftThing f (Thing x) = Thing (f x) It's like a Functor, but I can't make it an instance because Functor requires that the type be parametric. So I've been using type families to make a kind of "0 argument functor": class Functor0 a where type Elem a :: * fmap0 :: (Elem a -> Elem a) -> a -> a instance Functor0 Thing where type Elem Thing = X fmap0 = liftThing Is there a name for this? A better way to do it? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe