{-# Language GADTs #-}
module Language.Drasil.Constraint (
Constraint(..), ConstraintE, ConstraintReason(..),
physRange, sfwrRange, physElem, sfwrElem, isPhysC, isSfwrC
) where
import Language.Drasil.Expr.Lang
import Language.Drasil.Space (RealInterval(..))
data ConstraintReason = Physical | Software
type ConstraintE = Constraint Expr
data Constraint a where
Range :: ConstraintReason -> RealInterval a a -> Constraint a
Elem :: ConstraintReason -> a -> Constraint a
physRange :: RealInterval Expr Expr -> ConstraintE
physRange :: RealInterval Expr Expr -> ConstraintE
physRange = ConstraintReason -> RealInterval Expr Expr -> ConstraintE
forall a. ConstraintReason -> RealInterval a a -> Constraint a
Range ConstraintReason
Physical
physElem :: Expr -> ConstraintE
physElem :: Expr -> ConstraintE
physElem = ConstraintReason -> Expr -> ConstraintE
forall a. ConstraintReason -> a -> Constraint a
Elem ConstraintReason
Physical
sfwrRange :: RealInterval Expr Expr -> ConstraintE
sfwrRange :: RealInterval Expr Expr -> ConstraintE
sfwrRange = ConstraintReason -> RealInterval Expr Expr -> ConstraintE
forall a. ConstraintReason -> RealInterval a a -> Constraint a
Range ConstraintReason
Software
sfwrElem :: Expr -> ConstraintE
sfwrElem :: Expr -> ConstraintE
sfwrElem = ConstraintReason -> Expr -> ConstraintE
forall a. ConstraintReason -> a -> Constraint a
Elem ConstraintReason
Software
isPhysC, isSfwrC:: Constraint e -> Bool
isPhysC :: forall e. Constraint e -> Bool
isPhysC (Range ConstraintReason
Physical RealInterval e e
_) = Bool
True
isPhysC (Elem ConstraintReason
Physical e
_) = Bool
True
isPhysC Constraint e
_ = Bool
False
isSfwrC :: forall e. Constraint e -> Bool
isSfwrC (Range ConstraintReason
Software RealInterval e e
_) = Bool
True
isSfwrC (Elem ConstraintReason
Software e
_) = Bool
True
isSfwrC Constraint e
_ = Bool
False