module Ersatz.Internal.Literal
( Literal(..)
, negateLiteral
, Lit(..)
, lit
, negateLit
) where
import Data.Typeable
newtype Literal = Literal { literalId :: Int } deriving (Eq,Ord,Typeable)
instance Show Literal where
showsPrec i = showsPrec i . literalId
show = show . literalId
showList = showList . map literalId
negateLiteral :: Literal -> Literal
negateLiteral = Literal . negate . literalId
data Lit
= Lit !Literal
| Bool !Bool
deriving (Show, Typeable)
lit :: Bool -> Lit
lit = Bool
negateLit :: Lit -> Lit
negateLit (Bool b) = Bool (not b)
negateLit (Lit l) = Lit (negateLiteral l)