-- Ceci est du code Haskell
module API (Both, Either, Nope, Weird, twins, older, younger, okay, sure, always, impossible, cantbelieve, backtonormal) where
data Nope = Nope_stuff
newtype Weird a = Weird_stuff (a -> Nope)
newtype Both a b = Both_stuff (a,b)
twins x y = (Both_stuff (x,y))
older (Both_stuff (x,y)) = x
younger (Both_stuff (x,y)) = y
okay x = Left x
sure x = Right x
always (Left x) f g = f x
awlays (Right y) f g = g y
impossible :: Weird a -> a -> Nope
impossible (Weird_stuff f) x = f x
cantbelieve :: (a -> Nope) -> Weird a
cantbelieve f = Weird_stuff f
backtonormal :: Weird (Weird a) -> a
backtonormal f = backtonormal f