| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Language.Futhark.TypeChecker.Constraints
Description
Constraints produced (and solved) by the type checker.
Synopsis
- data Reason t
- = Reason Loc
- | ReasonPatMatch Loc (PatBase (NoInfo :: Type -> Type) VName StructType) t
- | ReasonAscription Loc t t
- | ReasonRetType Loc t t
- | ReasonApply Loc (Maybe (QualName VName), Int) Exp t t
- | ReasonApplySplit Loc (Maybe (QualName VName), Int) Exp t
- | ReasonBranches Loc t t
- type CtType d = TypeBase d NoMode
- data CtTy d = CtEq (Reason (CtType d)) (TypeBase d NoMode) (TypeBase d NoMode)
- data TyVarInfo d
- type Level = Int
- type TyVar = VName
- type TyVars d = Map TyVar (Level, TyVarInfo d)
- type TyParams = Map TyVar (Level, Liftedness, Loc)
Documentation
The reason for a type constraint. Used to generate type error messages. The expected type is always the first one.
Constructors
| Reason Loc | No particular reason. |
| ReasonPatMatch Loc (PatBase (NoInfo :: Type -> Type) VName StructType) t | Arising from pattern match. |
| ReasonAscription Loc t t | Arising from explicit ascription. |
| ReasonRetType Loc t t | |
| ReasonApply Loc (Maybe (QualName VName), Int) Exp t t | Arising from checking a function argument. The types are the expected (parameter) and actual (argument) types. |
| ReasonApplySplit Loc (Maybe (QualName VName), Int) Exp t | Used when unifying a type with a function type in a function application. If this unification fails, it means the supposed function was not a function after all. |
| ReasonBranches Loc t t |
Instances
| Functor Reason Source # | |
| Foldable Reason Source # | |
Defined in Language.Futhark.TypeChecker.Constraints Methods fold :: Monoid m => Reason m -> m # foldMap :: Monoid m => (a -> m) -> Reason a -> m # foldMap' :: Monoid m => (a -> m) -> Reason a -> m # foldr :: (a -> b -> b) -> b -> Reason a -> b # foldr' :: (a -> b -> b) -> b -> Reason a -> b # foldl :: (b -> a -> b) -> b -> Reason a -> b # foldl' :: (b -> a -> b) -> b -> Reason a -> b # foldr1 :: (a -> a -> a) -> Reason a -> a # foldl1 :: (a -> a -> a) -> Reason a -> a # elem :: Eq a => a -> Reason a -> Bool # maximum :: Ord a => Reason a -> a # minimum :: Ord a => Reason a -> a # | |
| Traversable Reason Source # | |
Defined in Language.Futhark.TypeChecker.Constraints | |
| Show t => Show (Reason t) Source # | |
| Eq t => Eq (Reason t) Source # | |
| Located (Reason t) Source # | |
A type constraint.
Information about a flexible type variable. Every type variable is associated with a location, which is the original syntax element that it is the type of.
Constructors
| TyVarFree Loc Liftedness | Can be substituted with anything. |
| TyVarPrim Loc [PrimType] | Can only be substituted with these primitive types. |
| TyVarRecord Loc (Map Name (CtType d)) | Must be a record with these fields. |
| TyVarSum Loc (Map Name [CtType d]) | Must be a sum type with these fields. |
The level at which a type variable is bound. Higher means
deeper. We can only unify a type variable at level i with a type
t if all type names that occur in t are at most at level i.