giml-language-0.1.0.0: A purely functional programming language with emphasis on structural typing
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

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))))

runParser :: CompilePhase Text env b m => Parser a -> FilePath -> Text -> m a Source #

Run a parse and prettyprint errors

Giml parser extra

mkPos :: Int -> Pos #

Construction of Pos from Int. The function throws InvalidPosException when given a non-positive argument.

Since: megaparsec-6.0.0

data Pos #

Pos is the type for positive integers. This is used to represent line number, column number, and similar things like indentation level. Semigroup instance can be used to safely and efficiently add Poses together.

Since: megaparsec-5.0.0

Instances

Instances details
Data Pos 
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) -> Pos -> c Pos #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pos #

toConstr :: Pos -> Constr #

dataTypeOf :: Pos -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pos) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pos) #

gmapT :: (forall b. Data b => b -> b) -> Pos -> Pos #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r #

gmapQ :: (forall d. Data d => d -> u) -> Pos -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pos -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

Semigroup Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

(<>) :: Pos -> Pos -> Pos #

sconcat :: NonEmpty Pos -> Pos #

stimes :: Integral b => b -> Pos -> Pos #

Generic Pos 
Instance details

Defined in Text.Megaparsec.Pos

Associated Types

type Rep Pos :: Type -> Type #

Methods

from :: Pos -> Rep Pos x #

to :: Rep Pos x -> Pos #

Read Pos 
Instance details

Defined in Text.Megaparsec.Pos

Show Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

NFData Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: Pos -> () #

Eq Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

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

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

Ord Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

compare :: Pos -> Pos -> Ordering #

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

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

(>) :: Pos -> Pos -> Bool #

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

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

type Rep Pos 
Instance details

Defined in Text.Megaparsec.Pos

type Rep Pos = D1 ('MetaData "Pos" "Text.Megaparsec.Pos" "megaparsec-9.2.1-3mG6PJi4RKfH1aTzhLevhN" 'True) (C1 ('MetaCons "Pos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

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