-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Manipulating Core Erlang source code
--
-- Facilities for manipulating Core Erlang source code: an abstract
-- syntax, parser and pretty-printer.
@package CoreErlang
@version 0.0.2
-- | A suite of datatypes describing the abstract syntax of CoreErlang
-- 1.0.3. http://www.it.uu.se/research/group/hipe/cerl/
module Language.CoreErlang.Syntax
-- | A CoreErlang source module.
data Module
Module :: Atom -> [Function] -> [(Atom, Const)] -> [FunDef] -> Module
-- | This type is used to represent lambdas
data FunDef
FunDef :: (Ann Function) -> (Ann Exp) -> FunDef
-- | CoreErlang expression.
data Exp
-- | variable
Var :: Var -> Exp
-- | literal constant
Lit :: Literal -> Exp
-- | function name
Fun :: Function -> Exp
-- | application
App :: Exps -> [Exps] -> Exp
-- | module call
ModCall :: (Exps, Exps) -> [Exps] -> Exp
-- | lambda expression
Lambda :: [Var] -> Exps -> Exp
-- | sequencing
Seq :: Exps -> Exps -> Exp
-- | local declaration
Let :: ([Var], Exps) -> Exps -> Exp
-- | letrec expression
LetRec :: [FunDef] -> Exps -> Exp
-- | case exp of alts end
Case :: Exps -> [Ann Alt] -> Exp
-- | tuple expression
Tuple :: [Exps] -> Exp
-- | list expression
List :: (List Exps) -> Exp
-- | binary expression
Binary :: [BitString Exps] -> Exp
-- | operator application
Op :: Atom -> [Exps] -> Exp
-- | try expression
Try :: Exps -> ([Var], Exps) -> ([Var], Exps) -> Exp
-- | receive expression
Rec :: [Ann Alt] -> TimeOut -> Exp
-- | catch expression
Catch :: Exps -> Exp
-- | CoreErlang expressions.
data Exps
-- | single expression
Exp :: (Ann Exp) -> Exps
-- | list of expressions
Exps :: (Ann [Ann Exp]) -> Exps
-- | An alt in a case expression
data Alt
Alt :: Pats -> Guard -> Exps -> Alt
-- | A guarded alternative when exp ->
-- exp. The first expression will be Boolean-valued.
data Guard
Guard :: Exps -> Guard
-- | A list of expressions
data List a
L :: [a] -> List a
LL :: [a] -> a -> List a
-- | The timeout of a receive expression
data TimeOut
TimeOut :: Exps -> Exps -> TimeOut
-- | A bitstring.
data BitString a
BitString :: a -> [Exps] -> BitString a
-- | This type is used to represent function names
data Function
Function :: (Atom, Integer) -> Function
data Pats
-- | single pattern
Pat :: Pat -> Pats
-- | list of patterns
Pats :: [Pat] -> Pats
-- | A pattern, to be matched against a value.
data Pat
-- | variable
PVar :: Var -> Pat
-- | literal constant
PLit :: Literal -> Pat
-- | tuple pattern
PTuple :: [Pat] -> Pat
-- | list pattern
PList :: (List Pat) -> Pat
-- | list of bitstring patterns
PBinary :: [BitString Pat] -> Pat
-- | alias pattern
PAlias :: Alias -> Pat
-- | An alias, used in patterns
data Alias
Alias :: Var -> Pat -> Alias
-- | literal. Values of this type hold the abstract value of the
-- literal, not the precise string representation used. For example,
-- 10, 0o12 and 0xa have the same
-- representation.
data Literal
-- | character literal
LChar :: Char -> Literal
-- | string literal
LString :: String -> Literal
-- | integer literal
LInt :: Integer -> Literal
-- | floating point literal
LFloat :: Double -> Literal
-- | atom literal
LAtom :: Atom -> Literal
-- | empty list
LNil :: Literal
-- | This type is used to represent constants
data Const
CLit :: Literal -> Const
CTuple :: [Const] -> Const
CList :: (List Const) -> Const
-- | This type is used to represent atoms
data Atom
Atom :: String -> Atom
-- | This type is used to represent variables
type Var = String
-- | An annotation for modules, variables, ...
data Ann a
-- | core erlang construct
Constr :: a -> Ann a
-- | core erlang annotated construct
Ann :: a -> [Const] -> Ann a
instance Typeable Atom
instance Typeable Function
instance Typeable Literal
instance Typeable1 List
instance Typeable Const
instance Typeable1 Ann
instance Typeable FunDef
instance Typeable Exp
instance Typeable TimeOut
instance Typeable Exps
instance Typeable Alt
instance Typeable Guard
instance Typeable Pats
instance Typeable Pat
instance Typeable Alias
instance Typeable1 BitString
instance Typeable Module
instance Eq Atom
instance Ord Atom
instance Show Atom
instance Data Atom
instance Eq Function
instance Ord Function
instance Show Function
instance Data Function
instance Eq Literal
instance Ord Literal
instance Show Literal
instance Data Literal
instance Eq a => Eq (List a)
instance Ord a => Ord (List a)
instance Show a => Show (List a)
instance Data a => Data (List a)
instance Eq Const
instance Ord Const
instance Show Const
instance Data Const
instance Eq a => Eq (Ann a)
instance Ord a => Ord (Ann a)
instance Show a => Show (Ann a)
instance Data a => Data (Ann a)
instance Eq FunDef
instance Ord FunDef
instance Show FunDef
instance Data FunDef
instance Eq Exp
instance Ord Exp
instance Show Exp
instance Data Exp
instance Eq TimeOut
instance Ord TimeOut
instance Show TimeOut
instance Data TimeOut
instance Eq Exps
instance Ord Exps
instance Show Exps
instance Data Exps
instance Eq Alt
instance Ord Alt
instance Show Alt
instance Data Alt
instance Eq Guard
instance Ord Guard
instance Show Guard
instance Data Guard
instance Eq Pats
instance Ord Pats
instance Show Pats
instance Data Pats
instance Eq Pat
instance Ord Pat
instance Show Pat
instance Data Pat
instance Eq Alias
instance Ord Alias
instance Show Alias
instance Data Alias
instance Eq a => Eq (BitString a)
instance Ord a => Ord (BitString a)
instance Show a => Show (BitString a)
instance Data a => Data (BitString a)
instance Eq Module
instance Ord Module
instance Show Module
instance Data Module
-- | Pretty printer for CoreErlang.
module Language.CoreErlang.Pretty
-- | Things that can be pretty-printed, including all the syntactic objects
-- in Language.CoreErlang.Syntax.
class Pretty a
-- | pretty-print with a given style and mode.
prettyPrintStyleMode :: Pretty a => Style -> PPMode -> a -> String
-- | pretty-print with the default style and a given mode.
prettyPrintWithMode :: Pretty a => PPMode -> a -> String
-- | pretty-print with the default style and defaultMode.
prettyPrint :: Pretty a => a -> String
-- | A rendering style.
data Style :: *
Style :: Mode -> Int -> Float -> Style
-- | The rendering mode
mode :: Style -> Mode
-- | Length of line, in chars
lineLength :: Style -> Int
-- | Ratio of ribbon length to line length
ribbonsPerLine :: Style -> Float
-- | The default style (mode=PageMode, lineLength=100,
-- ribbonsPerLine=1.5).
style :: Style
-- | Rendering mode.
data Mode :: *
-- | Normal
PageMode :: Mode
-- | With zig-zag cuts
ZigZagMode :: Mode
-- | No indentation, infinitely long lines
LeftMode :: Mode
-- | All on one line
OneLineMode :: Mode
-- | Pretty-printing parameters.
data PPMode
PPMode :: Indent -> Indent -> Indent -> Indent -> Indent -> Indent -> Indent -> PPLayout -> PPMode
-- | indentation of the alternatives in a case expression
altIndent :: PPMode -> Indent
-- | indentation of the declarations in a case expression
caseIndent :: PPMode -> Indent
-- | indentation of the declarations in a function definition
fundefIndent :: PPMode -> Indent
-- | indentation of the declarations in a lambda expression
lambdaIndent :: PPMode -> Indent
-- | indentation of the declarations in a let expression
letIndent :: PPMode -> Indent
-- | indentation of the declarations in a letrec expression
letrecIndent :: PPMode -> Indent
-- | indentation added for continuation lines that would otherwise be
-- offside
onsideIndent :: PPMode -> Indent
-- | Pretty-printing style to use
layout :: PPMode -> PPLayout
type Indent = Int
-- | Varieties of layout we can use.
data PPLayout
-- | classical layout
PPDefault :: PPLayout
-- | everything on a single line
PPNoLayout :: PPLayout
-- | The default mode: pretty-print using sensible defaults.
defaultMode :: PPMode
instance Eq PPLayout
instance Pretty a => Pretty (Ann a)
instance Pretty a => Pretty (BitString a)
instance Pretty TimeOut
instance Pretty Guard
instance Pretty Alias
instance Pretty Pat
instance Pretty Pats
instance Pretty Alt
instance Pretty a => Pretty (List a)
instance Pretty Exp
instance Pretty Exps
instance Pretty Atom
instance Pretty Literal
instance Pretty FunDef
instance Pretty Const
instance Pretty Function
instance Pretty Module
instance Monad (DocM s)
instance Functor (DocM s)
-- | CoreErlang parser.
-- http://www.it.uu.se/research/group/hipe/cerl/
module Language.CoreErlang.Parser
-- | Parse of a string, which should contain a complete CoreErlang module
parseModule :: String -> Either ParseError (Ann Module)
-- | The abstract data type ParseError represents parse errors. It
-- provides the source position (SourcePos) of the error and a
-- list of error messages (Message). A ParseError can be
-- returned by the function Text.Parsec.Prim.parse.
-- ParseError is an instance of the Show class.
data ParseError :: *