Safe Haskell | Safe-Inferred |
---|---|
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
- = EOF {
- loc :: a
- | TokIdent { }
- | TokTyCons { }
- | TokDouble { }
- | TokStrChunk { }
- | TokString { }
- | TokKeyword { }
- | TokSym { }
- | TokBuiltin { }
- = EOF {
- 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
- | Bind {
- 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
- exprBranch :: NonEmpty (Pattern a, Expression a)
- | Flatten {
- exprAnn :: a
- exprFlat :: Expression a
- | Annot {
- exprAnn :: a
- expr :: Expression a
- exprTy :: DickinsonTy a
- | Constructor {
- exprAnn :: a
- constructorName :: TyName a
- | BuiltinFn {
- exprAnn :: a
- exprBuiltin :: Builtin
- | Random { }
- data Builtin
- = Capitalize
- | AllCaps
- | Titlecase
- | Oulipo
- data Pattern 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
- renameExpressionM :: (MonadState s m, HasRenames s) => Expression a -> m (Expression a)
- resolveImport :: MonadIO m => [FilePath] -> Name a -> m (Maybe FilePath)
- pipelineBSL :: [FilePath] -> FilePath -> ByteString -> IO Text
- pipelineBSLErr :: [FilePath] -> FilePath -> ByteString -> IO (Either Text Text)
- validateBSL :: [FilePath] -> FilePath -> ByteString -> IO ()
- patternExhaustivenessBSL :: [FilePath] -> FilePath -> ByteString -> IO ()
- warnBSL :: ByteString -> IO ()
- defaultLibPath :: IO ([FilePath] -> [FilePath])
- dckPath :: IO [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
Data AlexPosn | |
Defined in Language.Dickinson.Lexer gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AlexPosn -> c AlexPosn # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AlexPosn # toConstr :: AlexPosn -> Constr # dataTypeOf :: AlexPosn -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AlexPosn) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AlexPosn) # gmapT :: (forall b. Data b => b -> b) -> AlexPosn -> AlexPosn # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AlexPosn -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AlexPosn -> r # gmapQ :: (forall d. Data d => d -> u) -> AlexPosn -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AlexPosn -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AlexPosn -> m AlexPosn # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AlexPosn -> m AlexPosn # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AlexPosn -> m AlexPosn # | |
Generic AlexPosn | |
Show AlexPosn | |
Binary AlexPosn | |
NFData AlexPosn | |
Defined in Language.Dickinson.Lexer | |
Eq AlexPosn | |
Pretty AlexPosn | |
Defined in Language.Dickinson.Lexer | |
type Rep AlexPosn | |
Defined in Language.Dickinson.Lexer type Rep AlexPosn = D1 ('MetaData "AlexPosn" "Language.Dickinson.Lexer" "language-dickinson-1.4.3.0-u4JKvBug5L7Xak6MfKGcR-dickinson" 'False) (C1 ('MetaCons "AlexPn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))) |
Instances
AST
Instances
Functor Dickinson | |
Generic (Dickinson a) | |
Show a => Show (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 | |
type Rep (Dickinson a) | |
Defined in Language.Dickinson.Type type Rep (Dickinson a) = D1 ('MetaData "Dickinson" "Language.Dickinson.Type" "language-dickinson-1.4.3.0-u4JKvBug5L7Xak6MfKGcR-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 | |
| |
Bind | |
| |
Var | |
Interp | |
| |
MultiInterp | |
| |
Lambda | |
| |
Apply | |
| |
Concat | |
| |
Tuple | |
| |
Match | |
| |
Flatten | |
| |
Annot | |
| |
Constructor | |
| |
BuiltinFn | |
| |
Random | |
Instances
Capitalize | |
AllCaps | |
Titlecase | |
Oulipo | Filter all |
Instances
Data Builtin | |
Defined in Language.Dickinson.Lexer gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Builtin -> c Builtin # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Builtin # toConstr :: Builtin -> Constr # dataTypeOf :: Builtin -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Builtin) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Builtin) # gmapT :: (forall b. Data b => b -> b) -> Builtin -> Builtin # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Builtin -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Builtin -> r # gmapQ :: (forall d. Data d => d -> u) -> Builtin -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Builtin -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Builtin -> m Builtin # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Builtin -> m Builtin # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Builtin -> m Builtin # | |
Generic Builtin | |
Show Builtin | |
Binary Builtin | |
NFData Builtin | |
Defined in Language.Dickinson.Lexer | |
Eq Builtin | |
Pretty Builtin | |
Defined in Language.Dickinson.Lexer | |
type Rep Builtin | |
Defined in Language.Dickinson.Lexer type Rep Builtin = D1 ('MetaData "Builtin" "Language.Dickinson.Lexer" "language-dickinson-1.4.3.0-u4JKvBug5L7Xak6MfKGcR-dickinson" 'False) ((C1 ('MetaCons "Capitalize" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AllCaps" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Titlecase" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Oulipo" 'PrefixI 'False) (U1 :: Type -> Type))) |
Instances
data DickinsonTy a #
TyText a | |
TyFun a (DickinsonTy a) (DickinsonTy a) | |
TyTuple a (NonEmpty (DickinsonTy a)) | |
TyNamed a (Name a) |
Instances
A (possibly qualified) name.
Instances
Functor Name | |
Data a => Data (Name a) | |
Defined in Language.Dickinson.Name gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name a -> c (Name a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Name a) # toConstr :: Name a -> Constr # dataTypeOf :: Name a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Name a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Name a)) # gmapT :: (forall b. Data b => b -> b) -> Name a -> Name a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name a -> r # gmapQ :: (forall d. Data d => d -> u) -> Name a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Name a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name a -> m (Name a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name a -> m (Name a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name a -> m (Name a) # | |
Generic (Name a) | |
Show a => Show (Name a) | |
Binary a => Binary (Name a) | |
NFData a => NFData (Name a) | |
Defined in Language.Dickinson.Name | |
Eq (Name a) | |
Ord (Name a) | |
Debug (Name a) | |
Defined in Language.Dickinson.Name | |
Pretty (Name a) | |
Defined in Language.Dickinson.Name | |
type Rep (Name a) | |
Defined in Language.Dickinson.Name type Rep (Name a) = D1 ('MetaData "Name" "Language.Dickinson.Name" "language-dickinson-1.4.3.0-u4JKvBug5L7Xak6MfKGcR-dickinson" 'False) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Text)) :*: (S1 ('MetaSel ('Just "unique") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) |
Renamer
class HasRenames a where #
Since: 0.1.1.0
Instances
HasRenames AmalgamateSt | |
Defined in Language.Dickinson.File | |
HasRenames Renames | |
HasRenames (EvalSt a) | |
renameExpressionM :: (MonadState s m, HasRenames s) => Expression a -> m (Expression a) #
Since: 0.1.1.0
Imports
The canonical way of resolving imports from a name.
Returns Nothing
if no such file exists.
Evaluation
Since: 1.4.2.0
validateBSL :: [FilePath] -> FilePath -> ByteString -> IO () #
Check scoping and types
Since: 1.4.1.0
:: [FilePath] | Includes |
-> FilePath | Source file (for error reporting) |
-> ByteString | |
-> IO () |
Since: 1.4.1.0
warnBSL :: ByteString -> IO () #
Run some lints
Since: 1.4.2.0
Path
defaultLibPath :: IO ([FilePath] -> [FilePath]) #