Module CurryInterface.Parser

This library defines a parser for Curry interfaces.

Version: September 2024

Summary of exported operations:

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

Exported operations:

pTrace :: String -> (String -> [(a,String)]) -> String -> [(a,String)]  Deterministic 

FOR TESTING

parseCurryInterface :: String -> Interface  Deterministic 

A parser for the text of a Curry interface.

interface :: String -> [(Interface,String)]  Deterministic 

A parser for a Curry interface.

moduleIdent :: String -> [(ModuleIdent,String)]  Deterministic 

A parser for a Module Identifier.

importDecls :: String -> [([IImportDecl],String)]  Deterministic 

A parser for a list of Import Declarations.

decls :: String -> [([IDecl],String)]  Deterministic 

A parser for a list of Declarations.

importDecl :: String -> [(IImportDecl,String)]  Deterministic 

A parser for an Import Declaration.

decl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Declaration.

infixDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for an Infix Declaration | Infix Arity Op

hidingDecl :: String -> [(IDecl,String)]  Deterministic 

hidingDataDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Hiding Data Declaration | hiding data QualIdent [KindExpr] TypeVariableList

hidingClassDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Hiding Class Declaration | hiding class [Context =>] QualIdent [KindExpr] TypeVariable

dataDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Data Declaration | data QualIdent [KindExpr] TypeVariableList = ConstrDeclList

newtypeDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Newtype Declaration | newtype QualIdent [KindExpr] TypeVariableList = Newtype

typeDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Type Declaration | type QualIdent [KindExpr] TypeVariableList = TypeExpr

functionDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Function Declaration | QualIdent [MethodPragma] Arity :: QualTypeExpr

classDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for a Class Declaration | class [Context =>] QualIdent [KindExpr] TypeVariable { MethodList } [Pragma]

singleton :: a -> [a]  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

funDeps :: String -> [([FunDep],String)]  Deterministic 

A parser for a list of functional dependencies | [| funDep {, funDep}]

funDep :: String -> [(FunDep,String)]  Deterministic 

A parser for a functional dependency | [Ident {, Ident}] -> [Ident {, Ident}]

instanceDecl :: String -> [(IDecl,String)]  Deterministic 

A parser for an Instance Declaration | instance [Context =>] QualIdent InstanceType { MethodImplList } [ModulePragma]

iInfix :: String -> [(Infix,String)]  Deterministic 

A parser for an Infix expression | {infixl | infixr | infix}

precedence :: String -> [(Int,String)]  Deterministic 

A parser for a Precedence

arity :: String -> [(Int,String)]  Deterministic 

A parser for an Arity

qualIdent :: String -> [(QualIdent,String)]  Deterministic 

A parser for a Qualified Identifier | [IdentList .] {Ident | Operator | ( Operator )}

identList :: String -> [([String],String)]  Deterministic 

A parser for a List of Identifiers | Ident [. IdentList]

ident :: String -> [(String,String)]  Deterministic 

A parser for an Identifier (not operator)

operator :: String -> [(String,String)]  Deterministic 

A parser for an Operator

typeVariable :: String -> [(String,String)]  Deterministic 

A parser for a Type Variable

typeVariableList :: String -> [([String],String)]  Deterministic 

A parser for a Type Variable List | TypeVariable [TypeVariableList]

typeVariableListNE :: String -> [([String],String)]  Deterministic 

A parser for a non-empty Type Variable List | TypeVariable [TypeVariableList]

hiddenPragma :: String -> [([Ident],String)]  Deterministic 

A parser for a Hidden Pragma | ADD SYNTAX DESCRIPTION

methodPragma :: String -> [(Ident,String)]  Deterministic 

A parser for a Method Pragma | ADD SYNTAX DESCRIPTION

modulePragma :: String -> [(ModuleIdent,String)]  Deterministic 

A parser for a Module Pragma | ADD SYNTAX DESCRIPTION

constrDecl :: String -> [(ConstrDecl,String)]  Deterministic 

A parser for a Constructor Declaration

constrDeclOp :: String -> [(ConstrDecl,String)]  Deterministic 

A parser for an Operator Constructor Declaration | TypeExpr Op TypeExpr

typeExpr :: String -> [(TypeExpr,String)]  Deterministic 

A parser for a Type Expression

typeExprs :: String -> [([TypeExpr],String)]  Deterministic 

type0 :: String -> [(TypeExpr,String)]  Deterministic 

type1 :: String -> [(TypeExpr,String)]  Deterministic 

type2 :: String -> [(TypeExpr,String)]  Deterministic 

identType :: String -> [(TypeExpr,String)]  Deterministic 

variableType :: String -> [(TypeExpr,String)]  Deterministic 

constructorType :: String -> [(TypeExpr,String)]  Deterministic 

parenType :: String -> [(TypeExpr,String)]  Deterministic 

arrowType :: String -> [(TypeExpr,String)]  Deterministic 

tupleType :: String -> [(TypeExpr,String)]  Deterministic 

bracketType :: String -> [(TypeExpr,String)]  Deterministic 

qualTypeExpr :: String -> [(QualTypeExpr,String)]  Deterministic 

A parser for a Qualified Type Expression | [Context =>] type0

context :: String -> [([Constraint],String)]  Deterministic 

A parser for a Context | {Constraint | (ConstraintList)}

constraint :: String -> [(Constraint,String)]  Deterministic 

A parser for a Constraint | QualType TypeExpr

qualType :: String -> [(QualIdent,String)]  Deterministic 

A parser for a Qualified Type | ADD SYNTAX DESCRIPTION

fieldDecl :: String -> [(FieldDecl,String)]  Deterministic 

A parser for a Field Declaration | IdentList :: TypeExpr

kind :: String -> [(KindExpr,String)]  Deterministic 

A parser for a Kind Expression | NOT YET IMPLEMENTED

kind0 :: String -> [(KindExpr,String)]  Deterministic 

kind1 :: String -> [(KindExpr,String)]  Deterministic 

iNewtype :: String -> [(NewConstrDecl,String)]  Deterministic 

A parser for a Newtype

methodDecl :: String -> [(IMethodDecl,String)]  Deterministic 

A parser for a Method Declaration | Ident [Arity] :: QualTypeExpr

instanceType :: String -> [([TypeExpr],String)]  Deterministic 

A parser for an Instance Type

methodImpl :: String -> [((Ident,Int),String)]  Deterministic 

A parser for a Method Implementation | {Ident | ( Op ))} Arity

toList :: a -> [a]  Deterministic 

Helper Functions Converts a value into a Singleton List

Further infos:
  • solution complete, i.e., able to compute all solutions

identToQualIdent :: Ident -> QualIdent  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

unwrapApply :: TypeExpr -> [TypeExpr]  Deterministic 

contextList :: String -> [([Constraint],String)]  Deterministic 

Helper parser

qualIdentWithContext :: String -> [(Either [Constraint] (QualIdent,Maybe KindExpr,[Ident]),String)]  Deterministic 

parenthesize :: (String -> [(String,String)]) -> String -> [(String,String)]  Deterministic 

Parses a string with enclosing parantheses

parseInt :: String -> [(Int,String)]  Deterministic 

A parser for an Integer

digit :: String -> [(Char,String)]  Deterministic 

A parser for a digit

choice :: [String -> [(a,String)]] -> String -> [(a,String)]  Deterministic 

Choose the first succeeding parser from a non-empty list of parsers

parseList :: (String -> [((),String)]) -> (String -> [(a,String)]) -> String -> [([a],String)]  Deterministic 

Parses a list using a parser for the seperator and a parser for the list elements

optional :: (String -> [(a,String)]) -> String -> [(Maybe a,String)]  Deterministic 

Tries to parse using the given parser or returns Nothing

parseSinglePragma :: (String -> [((),String)]) -> String -> [(Ident,String)]  Deterministic 

A parser for a single Pragma with a Pragma Token

withOptionalKind :: (a -> Maybe KindExpr -> b) -> (String -> [(a,String)]) -> String -> [(b,String)]  Deterministic 

missing :: String -> String -> [(a,String)]  Deterministic 

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

Further infos:
  • defined as left-associative infix operator with precedence 4

(<*?*) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

(*?*>) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

(<*!*>) :: (String -> [(a -> b,String)]) -> (String -> [(a,String)]) -> String -> [(b,String)]  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

(<*!*) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(a,String)]  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

(*!*>) :: (String -> [(a,String)]) -> (String -> [(b,String)]) -> String -> [(b,String)]  Deterministic 

Further infos:
  • defined as left-associative infix operator with precedence 4

ws :: String -> [((),String)]  Deterministic 

skipManyWs :: String -> [((),String)]  Deterministic 

skipSomeWs :: String -> [((),String)]  Deterministic 

skipWhitespace :: String -> [((),String)]  Deterministic 

tokenInterface :: String -> [((),String)]  Deterministic 

Tokens

tokenWhere :: String -> [((),String)]  Deterministic 

tokenImport :: String -> [((),String)]  Deterministic 

tokenClass :: String -> [((),String)]  Deterministic 

tokenData :: String -> [((),String)]  Deterministic 

tokenInstance :: String -> [((),String)]  Deterministic 

tokenHiding :: String -> [((),String)]  Deterministic 

tokenCurlyBracketL :: String -> [((),String)]  Deterministic 

tokenCurlyBracketR :: String -> [((),String)]  Deterministic 

tokenSemicolon :: String -> [((),String)]  Deterministic 

tokenComma :: String -> [((),String)]  Deterministic 

tokenTyping :: String -> [((),String)]  Deterministic 

tokenArrow :: String -> [((),String)]  Deterministic 

tokenDoubleArrow :: String -> [((),String)]  Deterministic 

tokenPragmaL :: String -> [((),String)]  Deterministic 

tokenPragmaR :: String -> [((),String)]  Deterministic 

tokenEqual :: String -> [((),String)]  Deterministic 

tokenPipe :: String -> [((),String)]  Deterministic 

tokenDot :: String -> [((),String)]  Deterministic 

tokenParenL :: String -> [((),String)]  Deterministic 

tokenParenR :: String -> [((),String)]  Deterministic 

tokenPragma :: String -> [((),String)]  Deterministic 

tokenPragmaLanguage :: String -> [((),String)]  Deterministic 

tokenPragmaOptions :: String -> [((),String)]  Deterministic 

tokenPragmaHiding :: String -> [((),String)]  Deterministic 

tokenPragmaMethod :: String -> [((),String)]  Deterministic 

tokenPragmaModule :: String -> [((),String)]  Deterministic 

tokenConstraint :: String -> [((),String)]  Deterministic 

tokenBracketL :: String -> [((),String)]  Deterministic 

tokenBracketR :: String -> [((),String)]  Deterministic 

tokenNewtype :: String -> [((),String)]  Deterministic 

tokenType :: String -> [((),String)]  Deterministic 

tokenBacktick :: String -> [((),String)]  Deterministic 

tokenStar :: String -> [((),String)]  Deterministic