Copyright | (c) 2011 Kathleen Fisher <kathleen.fisher@gmail.com> John Launchbury <john.launchbury@gmail.com> |
---|---|
License | MIT |
Maintainer | Karl Cronburg <karl@cs.tufts.edu> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Haskell data types, instances, and helper functions over these types for the syntax of Pads.
- data PadsDecl
- = PadsDeclType String [String] (Maybe Pat) PadsTy
- | PadsDeclData String [String] (Maybe Pat) PadsData [QString]
- | PadsDeclNew String [String] (Maybe Pat) BranchInfo [QString]
- | PadsDeclObtain String [String] PadsTy Exp
- data PadsTy
- data TermCond
- data PadsData
- = PUnion [BranchInfo]
- | PSwitch Exp [(Pat, BranchInfo)]
- data BranchInfo
- type FieldInfo = (Maybe String, ConstrArg, Maybe Exp)
- data PadsStrict
- type QString = [String]
- hasRep :: PadsTy -> Bool
- qName :: QString -> String
Documentation
AST form of a pads declaration with four flavors.
PadsDeclType String [String] (Maybe Pat) PadsTy | A pads type declaration e.g.: [pads| type Foo x y z (foo :: Int) = (x, y, z, foo) |] |
PadsDeclData String [String] (Maybe Pat) PadsData [QString] | A pads data declaration e.g.: [pads| data Foo x y z (foo :: Int) = Foo (x, y, z, foo) deriving (Eq, Ord, Show) |] |
PadsDeclNew String [String] (Maybe Pat) BranchInfo [QString] | A pads newtype declaration e.g.: [pads| newtype Foo x y z (foo :: Int) = Foo (x, y, z, foo) deriving (Eq, Ord, Show) |] |
PadsDeclObtain String [String] PadsTy Exp | A pads declaration for obtaining one type after parsing it from another, e.g.: [pads| obtain Foo x y z from Int using <|(fncn,inverse)|> |] |
AST form of a pads type, as notably used to the right hand side of an
equals sign in a
pads declaration.PadsDecl
PConstrain Pat PadsTy Exp | AST form of "constrain [pads| constrain x :: Digit where <|x `mod` 2|> == 0|> |] |
PTransform PadsTy PadsTy Exp | AST form of "transform [pads| transform StringFW 1 => Char using <|(head, list1)|> |] |
PList PadsTy (Maybe PadsTy) (Maybe TermCond) | AST form of a list of some The following [pads| [Int | ','] terminator EOF |] |
PPartition PadsTy Exp | AST form of a partitioned type "partition [pads| partition Entries using <| bytes 6 |> |] A partitioned type allows for parser extensions to make use of the state of the PADS parser in deciding how to divide up (partition) the input. |
PValue Exp PadsTy | AST form of a value constructor "value [pads| data Foo = Foo { x :: Int, xIsEven = value <| even x |> :: Bool } |] This allows you to do the opposite of what |
PApp [PadsTy] (Maybe Exp) | A pads type application like " [pads| data Foo = Foo { x :: Int, Bar x <| x + 1 |> |] |
PTuple [PadsTy] | AST form of a pads tuple "( [pads| (Int, "+", Int) |] |
PExpression Exp | An arbitrary Haskell expression as used in a |
PTycon QString | Pads type constructor with a qualified name |
PTyvar String | Pads type variable with a name |
Parser terminator condition
Right-hand side of a pads data type declaration
PUnion [BranchInfo] | A pads union data type declaration.
Syntax: " |
PSwitch Exp [(Pat, BranchInfo)] | A pads switch-case Syntax: case [pads| case <| tag + 1 |> of 2 -> Foo | 3 -> Bar |] |
data BranchInfo Source #
An individual branch of some pads data type, either defining a Haskell record parser or a Haskell constructor parser.
BRecord String [FieldInfo] (Maybe Exp) | Branch record with a constructor name, list of record fields, and maybe a boolean 'where' clause. Syntax: [pads| Foo { x :: Int, y :: Char } where <| x == ord y |> |
BConstr String [ConstrArg] (Maybe Exp) | Branch constructor with a constructor name, a list of argument types, and maybe a boolean 'where' clause: Syntax: [pads| Foo (x :: Int) (y :: Char) where <| x == ord y |> Note that this lets you bring variables into scope during parsing ( |
data PadsStrict Source #
A hold-over resulting from a deprecation moving from an older version of template-haskell.