giml-transform-0.1.0.0: Typing and transformations for Giml
Safe HaskellSafe-Inferred
LanguageGHC2021

Language.Giml

Description

Exporting the important stuff from the giml frontend

Synopsis

Giml frontend

data Error parseError Source #

Instances

Instances details
Show parseError => Show (Error parseError) Source # 
Instance details

Defined in Language.Giml

Methods

showsPrec :: Int -> Error parseError -> ShowS #

show :: Error parseError -> String #

showList :: [Error parseError] -> ShowS #

Eq parseError => Eq (Error parseError) Source # 
Instance details

Defined in Language.Giml

Methods

(==) :: Error parseError -> Error parseError -> Bool #

(/=) :: Error parseError -> Error parseError -> Bool #

Ord parseError => Ord (Error parseError) Source # 
Instance details

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

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

data 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

Instances details
Data SourcePos 
Instance details

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 
Instance details

Defined in Text.Megaparsec.Pos

Associated Types

type Rep SourcePos :: Type -> Type #

Read SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Show SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

NFData SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: SourcePos -> () #

Eq SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Ord SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Pretty SourcePos Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

pretty :: SourcePos -> Doc ann #

prettyList :: [SourcePos] -> Doc ann #

type Rep SourcePos 
Instance details

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

data Ann Source #

The annotation of the output: the input + the type

Constructors

Ann 

Fields

Instances

Instances details
Data Ann Source # 
Instance details

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 #

toConstr :: Ann -> Constr #

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 # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

showsPrec :: Int -> Ann -> ShowS #

show :: Ann -> String #

showList :: [Ann] -> ShowS #

Eq Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

(==) :: Ann -> Ann -> Bool #

(/=) :: Ann -> Ann -> Bool #

Ord Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

compare :: Ann -> Ann -> Ordering #

(<) :: Ann -> Ann -> Bool #

(<=) :: Ann -> Ann -> Bool #

(>) :: Ann -> Ann -> Bool #

(>=) :: Ann -> Ann -> Bool #

max :: Ann -> Ann -> Ann #

min :: Ann -> Ann -> Ann #

Pretty Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

pretty :: Ann -> Doc ann #

prettyList :: [Ann] -> Doc ann #

type InputAnn = Ann Source #

The annotation of the input

getType :: Expr Ann -> Type Source #

Retrieve the type of an expression. Will explode when used on a non EAnnotated node.

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

Giml Rewrites

removeAnn :: Functor f => Data a => Data (f ()) => f a -> f () Source #

Giml pretty printing

Giml logging