Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type TypeError = String
- type TypingContext t = Map UID t
- inferFromContext :: TypingContext t -> UID -> Either t TypeError
- class (Eq t, Show t) => Typed e t where
- infer :: TypingContext t -> e -> Either t TypeError
- check :: TypingContext t -> e -> t -> Either t TypeError
- class Typed e t => RequiresChecking c e t where
- requiredChecks :: c -> [(e, t)]
- typeCheckByInfer :: Typed e t => TypingContext t -> e -> t -> Either t TypeError
- allOfType :: Typed e t => TypingContext t -> [e] -> t -> t -> TypeError -> Either t TypeError
- temporaryIndent :: String -> String -> String
Documentation
type TypingContext t = Map UID t Source #
inferFromContext :: TypingContext t -> UID -> Either t TypeError Source #
Look for a known type of a specific UID
.
class (Eq t, Show t) => Typed e t where Source #
Build a bidirectional type checker for your expression language, e, with respect to a specific type universe, t.
infer :: TypingContext t -> e -> Either t TypeError Source #
Given a typing context and an expression, infer a unique type or explain what went awry.
check :: TypingContext t -> e -> t -> Either t TypeError Source #
Given a typing context, an expression, and an expected type, check if the expression can satisfy the expectation.
class Typed e t => RequiresChecking c e t where Source #
For all containers, c, which contain typed expressions, e, against a specific type universe, t, expose all expressions and relations that need to be type-checked.
requiredChecks :: c -> [(e, t)] Source #
All things that need type checking.
Instances
RequiresChecking DifferentialModel Expr Space Source # | |
Defined in Language.Drasil.Chunk.DifferentialModel requiredChecks :: DifferentialModel -> [(Expr, Space)] Source # | |
RequiresChecking (QDefinition Expr) Expr Space Source # | |
Defined in Language.Drasil.Chunk.Eq requiredChecks :: QDefinition Expr -> [(Expr, Space)] Source # |
typeCheckByInfer :: Typed e t => TypingContext t -> e -> t -> Either t TypeError Source #
`Check'
an expressions type based by an inference.