Safe Haskell | None |
---|---|
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
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 # | |
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
PrettyTCM SizeConstraint Source # | Assumes we are in the right context. | ||||
Defined in Agda.TypeChecking.SizedTypes.Solve prettyTCM :: MonadPretty m => SizeConstraint -> m Doc Source # | |||||
Subst SizeConstraint Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Solve
| |||||
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 # | |||||
Foldable (Constraint' rigid) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax fold :: Monoid m => Constraint' rigid m -> m # foldMap :: Monoid m => (a -> m) -> Constraint' rigid a -> m # foldMap' :: Monoid m => (a -> m) -> Constraint' rigid a -> m # foldr :: (a -> b -> b) -> b -> Constraint' rigid a -> b # foldr' :: (a -> b -> b) -> b -> Constraint' rigid a -> b # foldl :: (b -> a -> b) -> b -> Constraint' rigid a -> b # foldl' :: (b -> a -> b) -> b -> Constraint' rigid a -> b # foldr1 :: (a -> a -> a) -> Constraint' rigid a -> a # foldl1 :: (a -> a -> a) -> Constraint' rigid a -> a # toList :: Constraint' rigid a -> [a] # null :: Constraint' rigid a -> Bool # length :: Constraint' rigid a -> Int # elem :: Eq a => a -> Constraint' rigid a -> Bool # maximum :: Ord a => Constraint' rigid a -> a # minimum :: Ord a => Constraint' rigid a -> a # sum :: Num a => Constraint' rigid a -> a # product :: Num a => Constraint' rigid a -> a # | |||||
Traversable (Constraint' rigid) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax traverse :: Applicative f => (a -> f b) -> Constraint' rigid a -> f (Constraint' rigid b) # sequenceA :: Applicative f => Constraint' rigid (f a) -> f (Constraint' rigid a) # mapM :: Monad m => (a -> m b) -> Constraint' rigid a -> m (Constraint' rigid b) # sequence :: Monad m => Constraint' rigid (m a) -> m (Constraint' rigid a) # | |||||
Functor (Constraint' rigid) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax fmap :: (a -> b) -> Constraint' rigid a -> Constraint' rigid b # (<$) :: a -> Constraint' rigid b -> Constraint' rigid a # | |||||
(Pretty r, Pretty f) => Pretty (Constraint' r f) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax pretty :: Constraint' r f -> Doc Source # prettyPrec :: Int -> Constraint' r f -> Doc Source # prettyList :: [Constraint' r f] -> Doc Source # | |||||
Ord flex => Flexs (Constraint' rigid flex) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
flexs :: Constraint' rigid flex -> Set (FlexOf (Constraint' rigid flex)) Source # | |||||
Ord r => Rigids (Constraint' r f) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
rigids :: Constraint' r f -> Set (RigidOf (Constraint' r f)) Source # | |||||
(Show rigid, Show flex) => Show (Constraint' rigid flex) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax showsPrec :: Int -> Constraint' rigid flex -> ShowS # show :: Constraint' rigid flex -> String # showList :: [Constraint' rigid flex] -> ShowS # | |||||
type SubstArg SizeConstraint Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Solve | |||||
type FlexOf (Constraint' rigid flex) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax | |||||
type RigidOf (Constraint' r f) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax |
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.
Instances
Rigids a => Rigids [a] Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
| |||||
Ord r => Rigids (Constraint' r f) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
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
flexs :: HypSizeConstraint -> Set (FlexOf HypSizeConstraint) Source # | |||||
Flexs a => Flexs [a] Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
| |||||
Ord flex => Flexs (Constraint' rigid flex) Source # | |||||
Defined in Agda.TypeChecking.SizedTypes.Syntax
flexs :: Constraint' rigid flex -> Set (FlexOf (Constraint' rigid flex)) Source # | |||||
Ord flex => Flexs (SizeExpr' rigid flex) Source # | |||||