Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Syntax of size expressions and constraints.
Synopsis
- newtype Offset = O Int
- newtype Rigid = RigidId {}
- newtype Flex = FlexId {}
- 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
.
Instances
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 # | |
Pretty Offset Source # | |
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
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 # | |
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.
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 # | |