module Control.Egison.Matcher
( Pattern
, Matcher
, Something(..)
, ValuePattern(..)
, Eql(..)
)
where
import Control.Monad ( MonadPlus(..) )
type Pattern ps im it ot = ps -> im -> it -> [ot]
class Matcher m tgt
data Something = Something
instance Matcher Something a
class Eq t => ValuePattern m t where
value :: t -> Pattern () m t ()
default value :: Eq t => t -> Pattern () m t ()
value e () _ v = if e == v then pure () else mzero
valueM :: m -> t -> ()
default valueM :: m -> t -> ()
valueM _ _ = ()
data Eql = Eql
instance Eq a => Matcher Eql a
instance Eq a => ValuePattern Eql a