I wrote:
> You may find these handy:
> class SubType a b where
>       inj :: a -> b
>       prj :: b -> Maybe a
>
> instance SubType a (Either a b) where
>       inj a = Left a
>       prj (Left a) = a
>       prj (_) = Nothing

This should be:
instance SubType a (Either a b) where
        inj a = Left a
        prj (Left a) = a
        prj (Right b) = prj b

instance SubType Pow (Either Pro Pow)
        inj a = Right a
        prj (Right Pow) = Pow
        prj _ = Nothing

Regards,
John Hörnkvist




--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com

Reply via email to