module Data.Machine.Is
( Is(..)
) where
import Control.Category
import Data.Semigroup
import Prelude
data Is a b where
Refl :: Is a a
instance Show (Is a b) where
showsPrec _ Refl = showString "Refl"
instance Eq (Is a b) where
Refl == Refl = True
instance Ord (Is a b) where
Refl `compare` Refl = EQ
instance (a ~ b) => Semigroup (Is a b) where
Refl <> Refl = Refl
instance (a ~ b) => Monoid (Is a b) where
mempty = Refl
mappend = (<>)
instance (a ~ b) => Read (Is a b) where
readsPrec d = readParen (d > 10) (\r -> [(Refl,s) | ("Refl",s) <- lex r ])
instance Category Is where
id = Refl
Refl . Refl = Refl