module Data.Empty (
Empty(..),
unwrap
) where
import Control.Applicative (Alternative(..))
import Control.Monad (MonadPlus(..))
data Empty a = Empty
unwrap :: Empty a -> a
unwrap = undefined
const2 :: a -> b -> c -> a
const2 = const . const
instance Eq (Empty a) where
(==) = const2 True
instance Ord (Empty a) where
compare = const2 EQ
instance Monoid (Empty a) where
mempty = Empty
mappend = const2 Empty
instance Foldable Empty where
foldr _ = const
foldl _ = const
null = const False
length = const 0
elem = const2 False
instance Functor Empty where
fmap _ e = Empty
instance Traversable Empty where
traverse _ Empty = pure Empty
instance Applicative Empty where
pure = const Empty
(<*>) = const2 Empty
instance Alternative Empty where
empty = Empty
(<|>) = const2 Empty
instance Monad Empty where
(>>=) = const2 Empty
instance MonadPlus Empty where
mplus = const2 Empty