Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Language.Giml
Description
Exporting the important stuff from the giml frontend
Synopsis
- data Error parseError
- = ParseError parseError
- | TypeError TypeErrorA
- | PreInferError PreInferError
- parse :: CompilePhase Text env b m => FilePath -> Text -> m (ParsedFile SourcePos)
- parseInferPipeline :: MonadBase b b => LogAction b LogMsg -> FilePath -> Text -> ExceptT Text b (File Ann)
- parseInferPipeline' :: MonadBase b b => LogAction b LogMsg -> FilePath -> Text -> ExceptT (Error Text) b (File Ann)
- inferPipeline' :: MonadBase b b => LogAction b LogMsg -> ParsedFile InputAnn -> ExceptT (Error Text) b (File Ann)
- errorToText :: Error Text -> Text
- module Language.Giml.Syntax.Ast
- dummyAnn :: FilePath -> SourcePos
- runParser :: forall env (b :: Type -> Type) m a. CompilePhase Text env b m => Parser a -> FilePath -> Text -> m a
- parseFile :: Parser (ParsedFile SourcePos)
- data SourcePos = SourcePos {
- sourceName :: FilePath
- sourceLine :: !Pos
- sourceColumn :: !Pos
- data TypeError
- = TypeMismatch Type Type
- | UnboundVar Var
- | InfiniteType TypeVar Type
- | ArityMismatch Type Type
- | UnboundTypeVarsInType (Datatype InputAnn)
- | DuplicateTypeVarsInSig (Datatype InputAnn)
- | DuplicateConstrs (Datatype InputAnn)
- | DuplicateConstrs2 [(Constr, (VariantSig InputAnn, VariantSig InputAnn))]
- | NoSuchVariant Constr
- | RecordDiff Type Type [Label] [Label]
- | VariantDiff Type Type [Constr] [Constr]
- | NotARecord Type
- | NotAVariant Type
- | DuplicateVarsInPattern Pattern
- type TypeErrorA = ([InputAnn], TypeError)
- data Ann = Ann {}
- type InputAnn = Ann
- getType :: Expr Ann -> Type
- printAnn :: Ann -> Text
- ppTypeError :: TypeErrorA -> Text
- infer :: MonadBase b b => LogAction b LogMsg -> File InputAnn -> ExceptT TypeErrorA b (File Ann)
- module Language.Giml.Builtins
- module Language.Giml.Rewrites
- removeAnn :: Functor f => Data a => Data (f ()) => f a -> f ()
- printType :: Type -> Text
- printSourcePos :: SourcePos -> Text
- module Language.Giml.Logging
Giml frontend
data Error parseError Source #
Constructors
ParseError parseError | |
TypeError TypeErrorA | |
PreInferError PreInferError |
Instances
Show parseError => Show (Error parseError) Source # | |
Eq parseError => Eq (Error parseError) Source # | |
Ord parseError => Ord (Error parseError) Source # | |
Defined in Language.Giml Methods compare :: Error parseError -> Error parseError -> Ordering # (<) :: Error parseError -> Error parseError -> Bool # (<=) :: Error parseError -> Error parseError -> Bool # (>) :: Error parseError -> Error parseError -> Bool # (>=) :: Error parseError -> Error parseError -> Bool # max :: Error parseError -> Error parseError -> Error parseError # min :: Error parseError -> Error parseError -> Error parseError # |
parse :: CompilePhase Text env b m => FilePath -> Text -> m (ParsedFile SourcePos) Source #
Parse a Giml source file from text
parseInferPipeline :: MonadBase b b => LogAction b LogMsg -> FilePath -> Text -> ExceptT Text b (File Ann) Source #
Parse and infer a Giml source file from text
parseInferPipeline' :: MonadBase b b => LogAction b LogMsg -> FilePath -> Text -> ExceptT (Error Text) b (File Ann) Source #
Parse and infer a Giml source file from text, keeping errors structure
inferPipeline' :: MonadBase b b => LogAction b LogMsg -> ParsedFile InputAnn -> ExceptT (Error Text) b (File Ann) Source #
Infer a Giml File, keeping errors structure
Giml language definition
module Language.Giml.Syntax.Ast
Giml parser
runParser :: forall env (b :: Type -> Type) m a. CompilePhase Text env b m => Parser a -> FilePath -> Text -> m a #
Lexer and parser stream runParser :: Parser e -> FilePath -> Text -> Either (Either ErrBundle ParseErr) e
parseFile :: Parser (ParsedFile SourcePos) #
The data type SourcePos
represents source positions. It contains the
name of the source file, a line number, and a column number. Source line
and column positions change intensively during parsing, so we need to
make them strict to avoid memory leaks.
Constructors
SourcePos | |
Fields
|
Instances
Data SourcePos | |
Defined in Text.Megaparsec.Pos Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos # toConstr :: SourcePos -> Constr # dataTypeOf :: SourcePos -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) # gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # | |
Generic SourcePos | |
Read SourcePos | |
Show SourcePos | |
NFData SourcePos | |
Defined in Text.Megaparsec.Pos | |
Eq SourcePos | |
Ord SourcePos | |
Pretty SourcePos Source # | |
Defined in Language.Giml.Types.Infer.Types | |
type Rep SourcePos | |
Defined in Text.Megaparsec.Pos type Rep SourcePos = D1 ('MetaData "SourcePos" "Text.Megaparsec.Pos" "megaparsec-9.2.1-3mG6PJi4RKfH1aTzhLevhN" 'False) (C1 ('MetaCons "SourcePos" 'PrefixI 'True) (S1 ('MetaSel ('Just "sourceName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "sourceLine") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Pos) :*: S1 ('MetaSel ('Just "sourceColumn") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Pos)))) |
Giml Type Inference
The type of type errors.
Constructors
Instances
Show TypeError Source # | |
Eq TypeError Source # | |
Ord TypeError Source # | |
type TypeErrorA = ([InputAnn], TypeError) Source #
The annotation of the output: the input + the type
Instances
Data Ann Source # | |
Defined in Language.Giml.Types.Infer.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ann -> c Ann # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ann # dataTypeOf :: Ann -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Ann) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ann) # gmapT :: (forall b. Data b => b -> b) -> Ann -> Ann # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ann -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ann -> r # gmapQ :: (forall d. Data d => d -> u) -> Ann -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ann -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ann -> m Ann # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ann -> m Ann # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ann -> m Ann # | |
Show Ann Source # | |
Eq Ann Source # | |
Ord Ann Source # | |
Pretty Ann Source # | |
Defined in Language.Giml.Types.Infer.Types |
getType :: Expr Ann -> Type Source #
Retrieve the type of an expression. Will explode when used on a non EAnnotated
node.
ppTypeError :: TypeErrorA -> Text Source #
infer :: MonadBase b b => LogAction b LogMsg -> File InputAnn -> ExceptT TypeErrorA b (File Ann) Source #
Infer the types for all expressions in a source file
Giml builtin functions and types
module Language.Giml.Builtins
Giml Rewrites
module Language.Giml.Rewrites
Giml pretty printing
printSourcePos :: SourcePos -> Text #
Giml logging
module Language.Giml.Logging