[Haskell-cafe] redefining a type class for one instance?

Henning Thielemann lemming at henning-thielemann.de
Tue Apr 12 21:13:11 CEST 2011


On Tue, 12 Apr 2011, Edward Amsden wrote:

> 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

Would it be ok, to erm wrap 'a', say

newtype Generic a = Generic a

instance Liftable Wrapper (Generic a) where
  liftTo = ...


> instance Liftable Wrapper (Maybe a) where
>  liftTo = Nullable



More information about the Haskell-Cafe mailing list