Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Syntax of size expressions and constraints.
Synopsis
- newtype Offset = O Int
- newtype Rigid = RigidId {
- rigidId :: String
- newtype Flex = FlexId {
- flexId :: String
- data SizeExpr' rigid flex
- type SizeExpr = SizeExpr' Rigid Flex
- data Cmp
- data Constraint' rigid flex = Constraint {}
- type Constraint = Constraint' Rigid Flex
- data Polarity
- data PolarityAssignment flex = PolarityAssignment Polarity flex
- type Polarities flex = Map flex Polarity
- emptyPolarities :: Polarities flex
- polaritiesFromAssignments :: Ord flex => [PolarityAssignment flex] -> Polarities flex
- getPolarity :: Ord flex => Polarities flex -> flex -> Polarity
- newtype Solution rigid flex = Solution {
- theSolution :: Map flex (SizeExpr' rigid flex)
- emptySolution :: Solution r f
- class Substitute r f a where
- type Error = TCM Doc
- type CTrans r f = Constraint' r f -> Either Error [Constraint' r f]
- simplify1 :: (Pretty f, Pretty r, Eq r) => CTrans r f -> CTrans r f
- ifLe :: Cmp -> a -> a -> a
- compareOffset :: Offset -> Cmp -> Offset -> Bool
- class ValidOffset a where
- validOffset :: a -> Bool
- class TruncateOffset a where
- truncateOffset :: a -> a
- class Ord (RigidOf a) => Rigids a where
- class Ord (FlexOf a) => Flexs a where
Syntax
Constant finite sizes n >= 0
.
O Int |
Instances
Pretty Offset Source # | |
TruncateOffset Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax truncateOffset :: Offset -> Offset Source # | |
ValidOffset Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax validOffset :: Offset -> Bool Source # | |
MeetSemiLattice Offset Source # | |
Negative Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.WarshallSolver | |
Enum Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax | |
Num Offset Source # | |
Show Offset Source # | |
Eq Offset Source # | |
Ord Offset Source # | |
Plus Offset Offset Offset Source # | |
Plus Offset Weight Weight Source # | |
Plus Weight Offset Weight Source # | |
Plus (SizeExpr' r f) Offset (SizeExpr' r f) Source # | Add offset to size expression. |
Fixed size variables i
.
Size meta variables X
to solve for.
data SizeExpr' rigid flex Source #
Size expressions appearing in constraints.
Instances
Ord f => Substitute r f (SizeExpr' r f) Source # | |
Foldable (SizeExpr' rigid) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax fold :: Monoid m => SizeExpr' rigid m -> m foldMap :: Monoid m => (a -> m) -> SizeExpr' rigid a -> m foldMap' :: Monoid m => (a -> m) -> SizeExpr' rigid a -> m foldr :: (a -> b -> b) -> b -> SizeExpr' rigid a -> b foldr' :: (a -> b -> b) -> b -> SizeExpr' rigid a -> b foldl :: (b -> a -> b) -> b -> SizeExpr' rigid a -> b foldl' :: (b -> a -> b) -> b -> SizeExpr' rigid a -> b foldr1 :: (a -> a -> a) -> SizeExpr' rigid a -> a foldl1 :: (a -> a -> a) -> SizeExpr' rigid a -> a toList :: SizeExpr' rigid a -> [a] null :: SizeExpr' rigid a -> Bool length :: SizeExpr' rigid a -> Int elem :: Eq a => a -> SizeExpr' rigid a -> Bool maximum :: Ord a => SizeExpr' rigid a -> a minimum :: Ord a => SizeExpr' rigid a -> a | |
Traversable (SizeExpr' rigid) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax traverse :: Applicative f => (a -> f b) -> SizeExpr' rigid a -> f (SizeExpr' rigid b) sequenceA :: Applicative f => SizeExpr' rigid (f a) -> f (SizeExpr' rigid a) mapM :: Monad m => (a -> m b) -> SizeExpr' rigid a -> m (SizeExpr' rigid b) sequence :: Monad m => SizeExpr' rigid (m a) -> m (SizeExpr' rigid a) | |
Functor (SizeExpr' rigid) Source # | |
(Pretty r, Pretty f) => Pretty (SizeExpr' r f) Source # | |
Ord flex => Flexs (SizeExpr' rigid flex) Source # | |
Ord r => Rigids (SizeExpr' r f) Source # | |
TruncateOffset (SizeExpr' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax truncateOffset :: SizeExpr' r f -> SizeExpr' r f Source # | |
ValidOffset (SizeExpr' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax validOffset :: SizeExpr' r f -> Bool Source # | |
Subst (SizeExpr' NamedRigid SizeMeta) Source # | Only for |
Defined in Agda.TypeChecking.SizedTypes.Solve | |
(Show rigid, Show flex) => Show (SizeExpr' rigid flex) Source # | |
(Eq rigid, Eq flex) => Eq (SizeExpr' rigid flex) Source # | |
(Ord rigid, Ord flex) => Ord (SizeExpr' rigid flex) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax compare :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> Ordering (<) :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> Bool (<=) :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> Bool (>) :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> Bool (>=) :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> Bool max :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> SizeExpr' rigid flex min :: SizeExpr' rigid flex -> SizeExpr' rigid flex -> SizeExpr' rigid flex | |
Plus (SizeExpr' r f) Offset (SizeExpr' r f) Source # | Add offset to size expression. |
Plus (SizeExpr' r f) Label (SizeExpr' r f) Source # | |
Plus (SizeExpr' r f) Weight (SizeExpr' r f) Source # | |
type FlexOf (SizeExpr' rigid flex) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax | |
type RigidOf (SizeExpr' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax | |
type SubstArg (SizeExpr' NamedRigid SizeMeta) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Solve |
Comparison operator, e.g. for size expression.
data Constraint' rigid flex Source #
Constraint: an inequation between size expressions,
e.g. X < ∞
or i + 3 ≤ j
.
Instances
type Constraint = Constraint' Rigid Flex Source #
Polarities to specify solutions.
What type of solution are we looking for?
data PolarityAssignment flex Source #
Assigning a polarity to a flexible variable.
Instances
Pretty flex => Pretty (PolarityAssignment flex) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax pretty :: PolarityAssignment flex -> Doc Source # prettyPrec :: Int -> PolarityAssignment flex -> Doc Source # prettyList :: [PolarityAssignment flex] -> Doc Source # |
type Polarities flex = Map flex Polarity Source #
Type of solution wanted for each flexible.
emptyPolarities :: Polarities flex Source #
polaritiesFromAssignments :: Ord flex => [PolarityAssignment flex] -> Polarities flex Source #
getPolarity :: Ord flex => Polarities flex -> flex -> Polarity Source #
Default polarity is Least
.
Solutions.
newtype Solution rigid flex Source #
Partial substitution from flexible variables to size expression.
Solution | |
|
emptySolution :: Solution r f Source #
class Substitute r f a where Source #
Executing a substitution.
Instances
Substitute r f a => Substitute r f [a] Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax | |
Ord f => Substitute r f (Constraint' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax subst :: Solution r f -> Constraint' r f -> Constraint' r f Source # | |
Ord f => Substitute r f (SizeExpr' r f) Source # | |
Ord f => Substitute r f (Solution r f) Source # | |
Substitute r f a => Substitute r f (Map k a) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax |
Constraint simplification
type CTrans r f = Constraint' r f -> Either Error [Constraint' r f] Source #
simplify1 :: (Pretty f, Pretty r, Eq r) => CTrans r f -> CTrans r f Source #
Returns an error message if we have a contradictory constraint.
Printing
Wellformedness
class ValidOffset a where Source #
Offsets + n
must be non-negative
validOffset :: a -> Bool Source #
Instances
ValidOffset Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax validOffset :: Offset -> Bool Source # | |
ValidOffset (SizeExpr' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax validOffset :: SizeExpr' r f -> Bool Source # |
class TruncateOffset a where Source #
Make offsets non-negative by rounding up.
truncateOffset :: a -> a Source #
Instances
TruncateOffset Offset Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax truncateOffset :: Offset -> Offset Source # | |
TruncateOffset (SizeExpr' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax truncateOffset :: SizeExpr' r f -> SizeExpr' r f Source # |
Computing variable sets
class Ord (RigidOf a) => Rigids a where Source #
The rigid variables contained in a pice of syntax.
Instances
Rigids a => Rigids [a] Source # | |
Ord r => Rigids (Constraint' r f) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax type RigidOf (Constraint' r f) Source # rigids :: Constraint' r f -> Set (RigidOf (Constraint' r f)) Source # | |
Ord r => Rigids (SizeExpr' r f) Source # | |
class Ord (FlexOf a) => Flexs a where Source #
The flexibe variables contained in a pice of syntax.
Instances
Flexs HypSizeConstraint Source # | |
Defined in Agda.TypeChecking.SizedTypes.Solve type FlexOf HypSizeConstraint Source # flexs :: HypSizeConstraint -> Set (FlexOf HypSizeConstraint) Source # | |
Flexs a => Flexs [a] Source # | |
Ord flex => Flexs (Constraint' rigid flex) Source # | |
Defined in Agda.TypeChecking.SizedTypes.Syntax type FlexOf (Constraint' rigid flex) Source # flexs :: Constraint' rigid flex -> Set (FlexOf (Constraint' rigid flex)) Source # | |
Ord flex => Flexs (SizeExpr' rigid flex) Source # | |