Thingy

1
2
3
4
5
6
7
8
9
class Inject m where
   inject :: m a -> b -> m b
   takesValues :: m a -> Bool

instance Inject Maybe where
   inject (Just _) b = Just b
   inject _        _ = Nothing
   takesValues (Just _) = True
   takesValues _        = False