This library defines a parser for Curry interfaces.
Version: September 2024
pTrace
:: String -> (String -> [(a,String)]) -> String -> [(a,String)]
FOR TESTING |
parseCurryInterface
:: String -> Interface
A parser for the text of a Curry interface. |
interface
:: String -> [(Interface,String)]
A parser for a Curry interface. |
moduleIdent
:: String -> [(ModuleIdent,String)]
A parser for a Module Identifier. |
importDecls
:: String -> [([IImportDecl],String)]
A parser for a list of Import Declarations. |
decls
:: String -> [([IDecl],String)]
A parser for a list of Declarations. |
importDecl
:: String -> [(IImportDecl,String)]
A parser for an Import Declaration. |
decl
:: String -> [(IDecl,String)]
A parser for a Declaration. |
infixDecl
:: String -> [(IDecl,String)]
A parser for an Infix Declaration | Infix Arity Op |
hidingDecl
:: String -> [(IDecl,String)]
|
hidingDataDecl
:: String -> [(IDecl,String)]
A parser for a Hiding Data Declaration | hiding data QualIdent [KindExpr] TypeVariableList |
hidingClassDecl
:: String -> [(IDecl,String)]
A parser for a Hiding Class Declaration | hiding class [Context =>] QualIdent [KindExpr] TypeVariable |
dataDecl
:: String -> [(IDecl,String)]
A parser for a Data Declaration | data QualIdent [KindExpr] TypeVariableList = ConstrDeclList |
newtypeDecl
:: String -> [(IDecl,String)]
A parser for a Newtype Declaration | newtype QualIdent [KindExpr] TypeVariableList = Newtype |
typeDecl
:: String -> [(IDecl,String)]
A parser for a Type Declaration | type QualIdent [KindExpr] TypeVariableList = TypeExpr |
functionDecl
:: String -> [(IDecl,String)]
A parser for a Function Declaration | QualIdent [MethodPragma] Arity :: QualTypeExpr |
classDecl
:: String -> [(IDecl,String)]
A parser for a Class Declaration | class [Context =>] QualIdent [KindExpr] TypeVariable { MethodList } [Pragma] |
singleton
:: a -> [a]
|
funDeps
:: String -> [([FunDep],String)]
A parser for a list of functional dependencies | [| funDep {, funDep}] |
funDep
:: String -> [(FunDep,String)]
A parser for a functional dependency | [Ident {, Ident}] -> [Ident {, Ident}] |
instanceDecl
:: String -> [(IDecl,String)]
A parser for an Instance Declaration | instance [Context =>] QualIdent InstanceType { MethodImplList } [ModulePragma] |
iInfix
:: String -> [(Infix,String)]
A parser for an Infix expression | {infixl | infixr | infix} |
precedence
:: String -> [(Int,String)]
A parser for a Precedence |
arity
:: String -> [(Int,String)]
A parser for an Arity |
qualIdent
:: String -> [(QualIdent,String)]
A parser for a Qualified Identifier | [IdentList .] {Ident | Operator | ( Operator )} |
identList
:: String -> [([String],String)]
A parser for a List of Identifiers | Ident [. |
ident
:: String -> [(String,String)]
A parser for an Identifier (not operator) |
operator
:: String -> [(String,String)]
A parser for an Operator |
typeVariable
:: String -> [(String,String)]
A parser for a Type Variable |
typeVariableList
:: String -> [([String],String)]
A parser for a Type Variable List | TypeVariable [TypeVariableList] |
typeVariableListNE
:: String -> [([String],String)]
A parser for a non-empty Type Variable List | TypeVariable [TypeVariableList] |
:: String -> [([Ident],String)]
A parser for a Hidden Pragma | ADD SYNTAX DESCRIPTION |
methodPragma
:: String -> [(Ident,String)]
A parser for a Method Pragma | ADD SYNTAX DESCRIPTION |
modulePragma
:: String -> [(ModuleIdent,String)]
A parser for a Module Pragma | ADD SYNTAX DESCRIPTION |
constrDecl
:: String -> [(ConstrDecl,String)]
A parser for a Constructor Declaration |
constrDeclOp
:: String -> [(ConstrDecl,String)]
A parser for an Operator Constructor Declaration | TypeExpr Op TypeExpr |
typeExpr
:: String -> [(TypeExpr,String)]
A parser for a Type Expression |
typeExprs
:: String -> [([TypeExpr],String)]
|
type0
:: String -> [(TypeExpr,String)]
|
type1
:: String -> [(TypeExpr,String)]
|
type2
:: String -> [(TypeExpr,String)]
|
identType
:: String -> [(TypeExpr,String)]
|
variableType
:: String -> [(TypeExpr,String)]
|
constructorType
:: String -> [(TypeExpr,String)]
|
parenType
:: String -> [(TypeExpr,String)]
|
arrowType
:: String -> [(TypeExpr,String)]
|
tupleType
:: String -> [(TypeExpr,String)]
|
bracketType
:: String -> [(TypeExpr,String)]
|
qualTypeExpr
:: String -> [(QualTypeExpr,String)]
A parser for a Qualified Type Expression | [Context =>] type0 |
context
:: String -> [([Constraint],String)]
A parser for a Context | {Constraint | (ConstraintList)} |
constraint
:: String -> [(Constraint,String)]
A parser for a Constraint | QualType TypeExpr |
qualType
:: String -> [(QualIdent,String)]
A parser for a Qualified Type | ADD SYNTAX DESCRIPTION |
fieldDecl
:: String -> [(FieldDecl,String)]
A parser for a Field Declaration | IdentList :: TypeExpr |
kind
:: String -> [(KindExpr,String)]
A parser for a Kind Expression | NOT YET IMPLEMENTED |
kind0
:: String -> [(KindExpr,String)]
|
kind1
:: String -> [(KindExpr,String)]
|
iNewtype
:: String -> [(NewConstrDecl,String)]
A parser for a Newtype |
methodDecl
:: String -> [(IMethodDecl,String)]
A parser for a Method Declaration | Ident [Arity] :: QualTypeExpr |
instanceType
:: String -> [([TypeExpr],String)]
A parser for an Instance Type |
methodImpl
:: String -> [((Ident,Int),String)]
A parser for a Method Implementation | {Ident | ( Op ))} Arity |
toList
:: a -> [a]
Helper Functions Converts a value into a Singleton List |
identToQualIdent
:: Ident -> QualIdent
|
unwrapApply
:: TypeExpr -> [TypeExpr]
|
contextList
:: String -> [([Constraint],String)]
Helper parser |
qualIdentWithContext
:: String -> [(Either [Constraint] (QualIdent,Maybe KindExpr,[Ident]),String)]
|
parenthesize
:: (String -> [(String,String)]) -> String -> [(String,String)]
Parses a string with enclosing parantheses |
parseInt
:: String -> [(Int,String)]
A parser for an Integer |
digit
:: String -> [(Char,String)]
A parser for a digit |
choice
:: [String -> [(a,String)]] -> String -> [(a,String)]
Choose the first succeeding parser from a non-empty list of parsers |
parseList
:: (String -> [((),String)]) -> (String -> [(a,String)]) -> String -> [([a],String)]
Parses a list using a parser for the seperator and a parser for the list elements |
optional
:: (String -> [(a,String)]) -> String -> [(Maybe a,String)]
Tries to parse using the given parser or returns Nothing |
parseSinglePragma
:: (String -> [((),String)]) -> String -> [(Ident,String)]
A parser for a single Pragma with a Pragma Token |
withOptionalKind
:: (a -> Maybe KindExpr -> b) -> (String -> [(a,String)]) -> String -> [(b,String)]
|
missing
:: String -> String -> [(a,String)]
Debug function to fail with an error message of which function is not yet implemented. |
(<*?*>)
:: (String -> [(a -> b,String)]) -> (String -> [(a,String)]) -> String -> [(b,String)]
|
(<*?*)
:: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]
|
(*?*>)
:: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]
|
(<*!*>)
:: (String -> [(a -> b,String)]) -> (String -> [(a,String)]) -> String -> [(b,String)]
|
(<*!*)
:: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]
|
(*!*>)
:: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]
|
ws
:: String -> [((),String)]
|
skipManyWs
:: String -> [((),String)]
|
skipSomeWs
:: String -> [((),String)]
|
skipWhitespace
:: String -> [((),String)]
|
tokenInterface
:: String -> [((),String)]
Tokens |
tokenWhere
:: String -> [((),String)]
|
tokenImport
:: String -> [((),String)]
|
tokenClass
:: String -> [((),String)]
|
tokenData
:: String -> [((),String)]
|
tokenInstance
:: String -> [((),String)]
|
tokenHiding
:: String -> [((),String)]
|
tokenCurlyBracketL
:: String -> [((),String)]
|
tokenCurlyBracketR
:: String -> [((),String)]
|
tokenSemicolon
:: String -> [((),String)]
|
tokenComma
:: String -> [((),String)]
|
tokenTyping
:: String -> [((),String)]
|
tokenArrow
:: String -> [((),String)]
|
tokenDoubleArrow
:: String -> [((),String)]
|
tokenPragmaL
:: String -> [((),String)]
|
tokenPragmaR
:: String -> [((),String)]
|
tokenEqual
:: String -> [((),String)]
|
tokenPipe
:: String -> [((),String)]
|
tokenDot
:: String -> [((),String)]
|
tokenParenL
:: String -> [((),String)]
|
tokenParenR
:: String -> [((),String)]
|
tokenPragma
:: String -> [((),String)]
|
tokenPragmaLanguage
:: String -> [((),String)]
|
tokenPragmaOptions
:: String -> [((),String)]
|
tokenPragmaHiding
:: String -> [((),String)]
|
tokenPragmaMethod
:: String -> [((),String)]
|
tokenPragmaModule
:: String -> [((),String)]
|
tokenConstraint
:: String -> [((),String)]
|
tokenBracketL
:: String -> [((),String)]
|
tokenBracketR
:: String -> [((),String)]
|
tokenNewtype
:: String -> [((),String)]
|
tokenType
:: String -> [((),String)]
|
tokenBacktick
:: String -> [((),String)]
|
tokenStar
:: String -> [((),String)]
|
FOR TESTING |
A parser for the text of a Curry interface. |
A parser for a Module Identifier. |
A parser for a list of Import Declarations. |
A parser for an Import Declaration. |
|
A parser for a Hiding Data Declaration | hiding data QualIdent [KindExpr] TypeVariableList |
A parser for a Hiding Class Declaration | hiding class [Context =>] QualIdent [KindExpr] TypeVariable |
A parser for a Data Declaration | data QualIdent [KindExpr] TypeVariableList = ConstrDeclList |
A parser for a Newtype Declaration | newtype QualIdent [KindExpr] TypeVariableList = Newtype |
A parser for a Type Declaration | type QualIdent [KindExpr] TypeVariableList = TypeExpr |
A parser for a Function Declaration | QualIdent [MethodPragma] Arity :: QualTypeExpr |
A parser for a Class Declaration | class [Context =>] QualIdent [KindExpr] TypeVariable { MethodList } [Pragma] |
|
A parser for a list of functional dependencies | [| funDep {, funDep}] |
A parser for a functional dependency | [Ident {, Ident}] -> [Ident {, Ident}] |
A parser for an Instance Declaration | instance [Context =>] QualIdent InstanceType { MethodImplList } [ModulePragma] |
A parser for a Precedence |
A parser for an Arity |
A parser for a Qualified Identifier | [IdentList .] {Ident | Operator | ( Operator )} |
A parser for a List of Identifiers | Ident [. IdentList] |
A parser for an Identifier (not operator) |
A parser for an Operator |
A parser for a Type Variable |
A parser for a Type Variable List | TypeVariable [TypeVariableList] |
A parser for a non-empty Type Variable List | TypeVariable [TypeVariableList] |
A parser for a Method Pragma | ADD SYNTAX DESCRIPTION |
A parser for a Module Pragma | ADD SYNTAX DESCRIPTION |
A parser for a Constructor Declaration |
A parser for an Operator Constructor Declaration | TypeExpr Op TypeExpr |
|
|
|
A parser for a Qualified Type Expression | [Context =>] type0 |
A parser for a Context | {Constraint | (ConstraintList)} |
A parser for a Constraint | QualType TypeExpr |
A parser for a Field Declaration | IdentList :: TypeExpr |
A parser for a Newtype |
A parser for a Method Declaration | Ident [Arity] :: QualTypeExpr |
A parser for an Instance Type |
A parser for a Method Implementation | {Ident | ( Op ))} Arity |
Helper Functions Converts a value into a Singleton List
|
|
|
Helper parser |
|
Parses a string with enclosing parantheses |
A parser for an Integer |
A parser for a digit |
Choose the first succeeding parser from a non-empty list of parsers |
Parses a list using a parser for the seperator and a parser for the list elements |
Tries to parse using the given parser or returns Nothing |
A parser for a single Pragma with a Pragma Token |
|
Debug function to fail with an error message of which function is not yet implemented. |
|
|
|
|
|
|
|
|
|
|
Tokens |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|