duet/examples/good.hs
2019-11-15 16:15:35 +01:00

12 lines
252 B
Haskell

class Good a where
good :: a -> Bool
data Maybe a = Just a | Nothing
instance Good Bool where
good = \x -> x
instance Good a => Good (Maybe a) where
good = \x ->
case x of
Nothing -> False
Just a -> good a
main = good (Just True)