Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains some bits and pieces to work with Dickinson code.
Synopsis
- parse :: ByteString -> Either (ParseError AlexPosn) (Dickinson AlexPosn)
- data ParseError a
- = Unexpected (Token a)
- | LexErr String
- lexDickinson :: ByteString -> Either String [Token AlexPosn]
- data AlexPosn
- data Token a
- data Dickinson a
- data Declaration a
- data Expression a
- = Literal { }
- | StrChunk { }
- | Choice {
- exprAnn :: a
- choices :: NonEmpty (Double, Expression a)
- | Let {
- exprAnn :: a
- letBinds :: NonEmpty (Name a, Expression a)
- letExpr :: Expression a
- | Var { }
- | Interp {
- exprAnn :: a
- exprInterp :: [Expression a]
- | MultiInterp {
- exprAnn :: a
- exprMultiInterp :: [Expression a]
- | Lambda {
- exprAnn :: a
- lambdaVar :: Name a
- lambdaTy :: DickinsonTy a
- lambdaExpr :: Expression a
- | Apply {
- exprAnn :: a
- exprFun :: Expression a
- exprArg :: Expression a
- | Concat {
- exprAnn :: a
- exprConcats :: [Expression a]
- | Tuple {
- exprAnn :: a
- exprTup :: NonEmpty (Expression a)
- | Match {
- exprAnn :: a
- exprMatch :: Expression a
- exprPat :: Pattern a
- exprIn :: Expression a
- | Flatten {
- exprAnn :: a
- exprFlat :: Expression a
- | Annot {
- exprAnn :: a
- expr :: Expression a
- exprTy :: DickinsonTy a
- | Constructor {
- exprAnn :: a
- constructorName :: TyName a
- data Pattern a
- = PatternVar a (Name a)
- | PatternTuple a (NonEmpty (Pattern a))
- | PatternCons a (TyName a)
- | Wildcard a
- data DickinsonTy a
- = TyText a
- | TyFun a (DickinsonTy a) (DickinsonTy a)
- | TyTuple a (NonEmpty (DickinsonTy a))
- | TyNamed a (Name a)
- data Name a
- type TyName a = Name a
- class HasRenames a where
- rename :: Lens' a Renames
- renameExpressionM :: (MonadState s m, HasRenames s) => Expression a -> m (Expression a)
- resolveImport :: MonadIO m => [FilePath] -> Name a -> m (Maybe FilePath)
- dickinsonVersion :: Version
- dickinsonVersionString :: String
Parser
parse :: ByteString -> Either (ParseError AlexPosn) (Dickinson AlexPosn) #
data ParseError a #
Unexpected (Token a) | |
LexErr String |
Instances
Lexer
lexDickinson :: ByteString -> Either String [Token AlexPosn] #
Instances
Eq AlexPosn | |
Show AlexPosn | |
Generic AlexPosn | |
Binary AlexPosn | |
NFData AlexPosn | |
Defined in Language.Dickinson.Lexer | |
Pretty AlexPosn | |
Defined in Language.Dickinson.Lexer prettyList :: [AlexPosn] -> Doc ann | |
type Rep AlexPosn | |
Defined in Language.Dickinson.Lexer type Rep AlexPosn = D1 ('MetaData "AlexPosn" "Language.Dickinson.Lexer" "language-dickinson-0.1.1.1-inplace-dickinson" 'False) (C1 ('MetaCons "AlexPn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int)))) |
Instances
AST
Instances
Functor Dickinson | |
Show a => Show (Dickinson a) | |
Generic (Dickinson a) | |
Binary a => Binary (Dickinson a) | |
NFData a => NFData (Dickinson a) | |
Defined in Language.Dickinson.Type | |
Pretty (Dickinson a) | |
Defined in Language.Dickinson.Type pretty :: Dickinson a -> Doc ann prettyList :: [Dickinson a] -> Doc ann | |
type Rep (Dickinson a) | |
Defined in Language.Dickinson.Type type Rep (Dickinson a) = D1 ('MetaData "Dickinson" "Language.Dickinson.Type" "language-dickinson-0.1.1.1-inplace-dickinson" 'False) (C1 ('MetaCons "Dickinson" 'PrefixI 'True) (S1 ('MetaSel ('Just "modImports") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Import a]) :*: S1 ('MetaSel ('Just "modDefs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Declaration a]))) |
data Declaration a #
Instances
data Expression a #
Literal | |
StrChunk | |
Choice | |
| |
Let | |
| |
Var | |
Interp | |
| |
MultiInterp | |
| |
Lambda | |
| |
Apply | |
| |
Concat | |
| |
Tuple | |
| |
Match | |
| |
Flatten | |
| |
Annot | |
| |
Constructor | |
|
Instances
PatternVar a (Name a) | |
PatternTuple a (NonEmpty (Pattern a)) | |
PatternCons a (TyName a) | |
Wildcard a |
Instances
data DickinsonTy a #
TyText a | |
TyFun a (DickinsonTy a) (DickinsonTy a) | |
TyTuple a (NonEmpty (DickinsonTy a)) | |
TyNamed a (Name a) |
Instances
Instances
Functor Name | |
Eq (Name a) | |
Ord (Name a) | |
Show a => Show (Name a) | |
Generic (Name a) | |
Binary a => Binary (Name a) | |
NFData a => NFData (Name a) | |
Defined in Language.Dickinson.Name | |
Pretty (Name a) | |
Defined in Language.Dickinson.Name prettyList :: [Name a] -> Doc ann | |
type Rep (Name a) | |
Defined in Language.Dickinson.Name type Rep (Name a) = D1 ('MetaData "Name" "Language.Dickinson.Name" "language-dickinson-0.1.1.1-inplace-dickinson" 'False) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Text)) :*: (S1 ('MetaSel ('Just "unique") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Unique) :*: S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) |
Renamer
class HasRenames a where #
Instances
HasRenames Renames | |
Defined in Language.Dickinson.Rename |
renameExpressionM :: (MonadState s m, HasRenames s) => Expression a -> m (Expression a) #