Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Data.ProtoLens.Compiler.Combinators
Contents
Description
Some utility functions, classes and instances for nicer code generation.
Re-exports simpler versions of the types and constructors from
haskell-src-exts
.
We define orphan instances of IsString for various syntax
datatypes, with some intelligence about Haskell names. For example, "foo"
:: Exp
is treated as a variable and Foo :: Exp
is treated as a
constructor.
Synopsis
- class App a where
- (@@) :: a -> a -> a
- type Promoted = Promoted ()
- type Type = Type ()
- type TyVarBind = TyVarBind ()
- type QName = QName ()
- type Pat = Pat ()
- type Name = Name ()
- type ModulePragma = ModulePragma ()
- type ModuleName = ModuleName ()
- type ExportSpec = ExportSpec ()
- data CommentedDecl = CommentedDecl (Maybe String) Decl
- data Module = Module ModuleName (Maybe [ExportSpec]) [ModulePragma] [ImportDecl ()] [CommentedDecl]
- type Match = Match ()
- type InstHead = InstHead ()
- type FieldUpdate = FieldUpdate ()
- type Stmt = Stmt ()
- type Alt = Alt ()
- type Exp = Exp ()
- type Deriving = Deriving ()
- type Decl = Decl ()
- type ConDecl = ConDecl ()
- type Asst = Asst ()
- prettyPrint :: Pretty a => a -> String
- prettyPrim :: Pretty a => a -> Doc
- classA :: QName -> [Type] -> Asst
- equalP :: Type -> Type -> Asst
- conDecl :: Name -> [Type] -> ConDecl
- recDecl :: Name -> [(Name, Type)] -> ConDecl
- patSynSig :: Name -> Type -> Decl
- patSyn :: Pat -> Pat -> Decl
- dataDecl :: Name -> [ConDecl] -> Deriving -> Decl
- newtypeDecl :: Name -> Type -> Deriving -> Decl
- dataDeclHelper :: DataOrNew () -> Name -> [ConDecl] -> Deriving -> Decl
- deriving' :: [QName] -> Deriving
- funBind :: [Match] -> Decl
- patBind :: Pat -> Exp -> Decl
- instType :: Type -> Type -> InstDecl ()
- instMatch :: [Match] -> InstDecl ()
- instDeclWithTypes :: [Asst] -> InstHead -> [InstDecl ()] -> Decl
- instDecl :: [Asst] -> InstHead -> [[Match]] -> Decl
- typeSig :: [Name] -> Type -> Decl
- let' :: [Decl] -> Exp -> Exp
- case' :: Exp -> [Alt] -> Exp
- (-->) :: Pat -> Exp -> Alt
- stringExp :: String -> Exp
- charExp :: Char -> Exp
- tuple :: [Exp] -> Exp
- lambda :: [Pat] -> Exp -> Exp
- (@::@) :: Exp -> Type -> Exp
- recConstr :: QName -> [FieldUpdate] -> Exp
- recUpdate :: Exp -> [FieldUpdate] -> Exp
- var :: QName -> Exp
- con :: QName -> Exp
- list :: [Exp] -> Exp
- if' :: Exp -> Exp -> Exp -> Exp
- cons :: Exp
- emptyList :: Exp
- unit :: Exp
- typeApp :: Type -> Exp
- do' :: [Stmt] -> Exp
- (<--) :: Pat -> Exp -> Stmt
- stmt :: Exp -> Stmt
- letStmt :: [Decl] -> Stmt
- fieldUpdate :: QName -> Exp -> FieldUpdate
- ihApp :: InstHead -> [Type] -> InstHead
- tyParen :: Type -> Type
- tyFun :: Type -> Type -> Type
- match :: Name -> [Pat] -> Exp -> Match
- guardedMatch :: Name -> [Pat] -> [(Exp, Exp)] -> Match
- uncommented :: Decl -> CommentedDecl
- commented :: String -> Decl -> CommentedDecl
- prettyPrintModule :: Module -> String
- getModuleName :: Module -> ModuleName
- languagePragma :: [Name] -> ModulePragma
- optionsGhcPragma :: String -> ModulePragma
- exportVar :: QName -> ExportSpec
- exportAll :: QName -> ExportSpec
- exportWith :: QName -> [Name] -> ExportSpec
- pApp :: QName -> [Pat] -> Pat
- pVar :: Name -> Pat
- pWildCard :: Pat
- stringPat :: String -> Pat
- bangPat :: Pat -> Pat
- patTypeSig :: Pat -> Type -> Pat
- qual :: ModuleName -> Name -> QName
- unQual :: Name -> QName
- tyCon :: QName -> Type
- tyList :: Type -> Type
- tyPromotedList :: [Type] -> Type
- tyPromotedString :: String -> Type
- tyPromotedCon :: Promoted -> Type
- tyForAll :: [TyVarBind] -> [Asst] -> Type -> Type
- tyBang :: Type -> Type
- tyWildCard :: Type
- isIdentChar :: Char -> Bool
- litInt :: Integer -> Exp
- litFrac :: Rational -> Exp
- pLitInt :: Integer -> Pat
- string :: String -> Literal ()
- char :: Char -> Literal ()
- modifyModuleName :: (String -> String) -> ModuleName -> ModuleName
- data ImportDecl l = ImportDecl {
- importAnn :: l
- importModule :: ModuleName l
- importQualified :: Bool
- importSrc :: Bool
- importSafe :: Bool
- importPkg :: Maybe String
- importAs :: Maybe (ModuleName l)
- importSpecs :: Maybe (ImportSpecList l)
Documentation
Application of a Haskell type or expression to an argument.
For example, to represent f x y
, you can write
"f" @@ "x" @@ "y"
type ModulePragma = ModulePragma () Source #
type ModuleName = ModuleName () Source #
type ExportSpec = ExportSpec () Source #
data CommentedDecl Source #
A declaration, along with an optional comment.
Constructors
CommentedDecl (Maybe String) Decl |
A hand-rolled type for modules, which allows comments on top-level declarations.
Constructors
Module ModuleName (Maybe [ExportSpec]) [ModulePragma] [ImportDecl ()] [CommentedDecl] |
type FieldUpdate = FieldUpdate () Source #
prettyPrint :: Pretty a => a -> String Source #
prettyPrim :: Pretty a => a -> Doc Source #
fieldUpdate :: QName -> Exp -> FieldUpdate Source #
uncommented :: Decl -> CommentedDecl Source #
prettyPrintModule :: Module -> String Source #
getModuleName :: Module -> ModuleName Source #
languagePragma :: [Name] -> ModulePragma Source #
exportVar :: QName -> ExportSpec Source #
exportAll :: QName -> ExportSpec Source #
exportWith :: QName -> [Name] -> ExportSpec Source #
tyPromotedList :: [Type] -> Type Source #
tyPromotedString :: String -> Type Source #
tyPromotedCon :: Promoted -> Type Source #
tyWildCard :: Type Source #
isIdentChar :: Char -> Bool Source #
Whether this character belongs to an Ident (e.g., "foo") or a symbol (e.g., "$").
modifyModuleName :: (String -> String) -> ModuleName -> ModuleName Source #
data ImportDecl l #
An import declaration.
Constructors
ImportDecl | |
Fields
|
Instances
Orphan instances
IsString Promoted Source # | |
Methods fromString :: String -> Promoted # | |
IsString Type Source # | |
Methods fromString :: String -> Type # | |
IsString TyVarBind Source # | |
Methods fromString :: String -> TyVarBind # | |
IsString QName Source # | |
Methods fromString :: String -> QName # | |
IsString Pat Source # | |
Methods fromString :: String -> Pat # | |
IsString Name Source # | |
Methods fromString :: String -> Name # | |
IsString ModuleName Source # | |
Methods fromString :: String -> ModuleName # | |
IsString InstHead Source # | |
Methods fromString :: String -> InstHead # | |
IsString Exp Source # | |
Methods fromString :: String -> Exp # |