{-# LANGUAGE Safe #-}
module Language.Haskell.TH.Lib.Internal where
import Language.Haskell.TH.Syntax hiding (Role, InjectivityAnn)
import qualified Language.Haskell.TH.Syntax as TH
import Control.Monad( liftM, liftM2 )
import Data.Word( Word8 )
import Prelude
type InfoQ = Q Info
type PatQ = Q Pat
type FieldPatQ = Q FieldPat
type ExpQ = Q Exp
type TExpQ a = Q (TExp a)
type DecQ = Q Dec
type DecsQ = Q [Dec]
type ConQ = Q Con
type TypeQ = Q Type
type KindQ = Q Kind
type TyVarBndrQ = Q TyVarBndr
type TyLitQ = Q TyLit
type CxtQ = Q Cxt
type PredQ = Q Pred
type DerivClauseQ = Q DerivClause
type MatchQ = Q Match
type ClauseQ = Q Clause
type BodyQ = Q Body
type GuardQ = Q Guard
type StmtQ = Q Stmt
type RangeQ = Q Range
type SourceStrictnessQ = Q SourceStrictness
type SourceUnpackednessQ = Q SourceUnpackedness
type BangQ = Q Bang
type BangTypeQ = Q BangType
type VarBangTypeQ = Q VarBangType
type StrictTypeQ = Q StrictType
type VarStrictTypeQ = Q VarStrictType
type FieldExpQ = Q FieldExp
type RuleBndrQ = Q RuleBndr
type TySynEqnQ = Q TySynEqn
type PatSynDirQ = Q PatSynDir
type PatSynArgsQ = Q PatSynArgs
type FamilyResultSigQ = Q FamilyResultSig
type DerivStrategyQ = Q DerivStrategy
type Role = TH.Role
type InjectivityAnn = TH.InjectivityAnn
intPrimL :: Integer -> Lit
intPrimL :: Integer -> Lit
intPrimL = Integer -> Lit
IntPrimL
wordPrimL :: Integer -> Lit
wordPrimL :: Integer -> Lit
wordPrimL = Integer -> Lit
WordPrimL
floatPrimL :: Rational -> Lit
floatPrimL :: Rational -> Lit
floatPrimL = Rational -> Lit
FloatPrimL
doublePrimL :: Rational -> Lit
doublePrimL :: Rational -> Lit
doublePrimL = Rational -> Lit
DoublePrimL
integerL :: Integer -> Lit
integerL :: Integer -> Lit
integerL = Integer -> Lit
IntegerL
charL :: Char -> Lit
charL :: Char -> Lit
charL = Char -> Lit
CharL
charPrimL :: Char -> Lit
charPrimL :: Char -> Lit
charPrimL = Char -> Lit
CharPrimL
stringL :: String -> Lit
stringL :: String -> Lit
stringL = String -> Lit
StringL
stringPrimL :: [Word8] -> Lit
stringPrimL :: [Word8] -> Lit
stringPrimL = [Word8] -> Lit
StringPrimL
bytesPrimL :: Bytes -> Lit
bytesPrimL :: Bytes -> Lit
bytesPrimL = Bytes -> Lit
BytesPrimL
rationalL :: Rational -> Lit
rationalL :: Rational -> Lit
rationalL = Rational -> Lit
RationalL
litP :: Lit -> PatQ
litP :: Lit -> PatQ
litP Lit
l = Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Lit -> Pat
LitP Lit
l)
varP :: Name -> PatQ
varP :: Name -> PatQ
varP Name
v = Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Pat
VarP Name
v)
tupP :: [PatQ] -> PatQ
tupP :: [PatQ] -> PatQ
tupP [PatQ]
ps = do { [Pat]
ps1 <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps; Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Pat] -> Pat
TupP [Pat]
ps1)}
unboxedTupP :: [PatQ] -> PatQ
unboxedTupP :: [PatQ] -> PatQ
unboxedTupP [PatQ]
ps = do { [Pat]
ps1 <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps; Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Pat] -> Pat
UnboxedTupP [Pat]
ps1)}
unboxedSumP :: PatQ -> SumAlt -> SumArity -> PatQ
unboxedSumP :: PatQ -> SumAlt -> SumAlt -> PatQ
unboxedSumP PatQ
p SumAlt
alt SumAlt
arity = do { Pat
p1 <- PatQ
p; Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> SumAlt -> SumAlt -> Pat
UnboxedSumP Pat
p1 SumAlt
alt SumAlt
arity) }
conP :: Name -> [PatQ] -> PatQ
conP :: Name -> [PatQ] -> PatQ
conP Name
n [PatQ]
ps = do [Pat]
ps' <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> [Pat] -> Pat
ConP Name
n [Pat]
ps')
infixP :: PatQ -> Name -> PatQ -> PatQ
infixP :: PatQ -> Name -> PatQ -> PatQ
infixP PatQ
p1 Name
n PatQ
p2 = do Pat
p1' <- PatQ
p1
Pat
p2' <- PatQ
p2
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Name -> Pat -> Pat
InfixP Pat
p1' Name
n Pat
p2')
uInfixP :: PatQ -> Name -> PatQ -> PatQ
uInfixP :: PatQ -> Name -> PatQ -> PatQ
uInfixP PatQ
p1 Name
n PatQ
p2 = do Pat
p1' <- PatQ
p1
Pat
p2' <- PatQ
p2
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Name -> Pat -> Pat
UInfixP Pat
p1' Name
n Pat
p2')
parensP :: PatQ -> PatQ
parensP :: PatQ -> PatQ
parensP PatQ
p = do Pat
p' <- PatQ
p
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Pat
ParensP Pat
p')
tildeP :: PatQ -> PatQ
tildeP :: PatQ -> PatQ
tildeP PatQ
p = do Pat
p' <- PatQ
p
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Pat
TildeP Pat
p')
bangP :: PatQ -> PatQ
bangP :: PatQ -> PatQ
bangP PatQ
p = do Pat
p' <- PatQ
p
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Pat
BangP Pat
p')
asP :: Name -> PatQ -> PatQ
asP :: Name -> PatQ -> PatQ
asP Name
n PatQ
p = do Pat
p' <- PatQ
p
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Pat -> Pat
AsP Name
n Pat
p')
wildP :: PatQ
wildP :: PatQ
wildP = Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return Pat
WildP
recP :: Name -> [FieldPatQ] -> PatQ
recP :: Name -> [FieldPatQ] -> PatQ
recP Name
n [FieldPatQ]
fps = do [FieldPat]
fps' <- [FieldPatQ] -> Q [FieldPat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [FieldPatQ]
fps
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> [FieldPat] -> Pat
RecP Name
n [FieldPat]
fps')
listP :: [PatQ] -> PatQ
listP :: [PatQ] -> PatQ
listP [PatQ]
ps = do [Pat]
ps' <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Pat] -> Pat
ListP [Pat]
ps')
sigP :: PatQ -> TypeQ -> PatQ
sigP :: PatQ -> TypeQ -> PatQ
sigP PatQ
p TypeQ
t = do Pat
p' <- PatQ
p
Type
t' <- TypeQ
t
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Type -> Pat
SigP Pat
p' Type
t')
viewP :: ExpQ -> PatQ -> PatQ
viewP :: ExpQ -> PatQ -> PatQ
viewP ExpQ
e PatQ
p = do Exp
e' <- ExpQ
e
Pat
p' <- PatQ
p
Pat -> PatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Pat -> Pat
ViewP Exp
e' Pat
p')
fieldPat :: Name -> PatQ -> FieldPatQ
fieldPat :: Name -> PatQ -> FieldPatQ
fieldPat Name
n PatQ
p = do Pat
p' <- PatQ
p
FieldPat -> FieldPatQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
n, Pat
p')
bindS :: PatQ -> ExpQ -> StmtQ
bindS :: PatQ -> ExpQ -> StmtQ
bindS PatQ
p ExpQ
e = (Pat -> Exp -> Stmt) -> PatQ -> ExpQ -> StmtQ
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 Pat -> Exp -> Stmt
BindS PatQ
p ExpQ
e
letS :: [DecQ] -> StmtQ
letS :: [DecQ] -> StmtQ
letS [DecQ]
ds = do { [Dec]
ds1 <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
ds; Stmt -> StmtQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Dec] -> Stmt
LetS [Dec]
ds1) }
noBindS :: ExpQ -> StmtQ
noBindS :: ExpQ -> StmtQ
noBindS ExpQ
e = do { Exp
e1 <- ExpQ
e; Stmt -> StmtQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Stmt
NoBindS Exp
e1) }
parS :: [[StmtQ]] -> StmtQ
parS :: [[StmtQ]] -> StmtQ
parS [[StmtQ]]
sss = do { [[Stmt]]
sss1 <- ([StmtQ] -> Q [Stmt]) -> [[StmtQ]] -> Q [[Stmt]]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [[StmtQ]]
sss; Stmt -> StmtQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([[Stmt]] -> Stmt
ParS [[Stmt]]
sss1) }
recS :: [StmtQ] -> StmtQ
recS :: [StmtQ] -> StmtQ
recS [StmtQ]
ss = do { [Stmt]
ss1 <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss; Stmt -> StmtQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Stmt
RecS [Stmt]
ss1) }
fromR :: ExpQ -> RangeQ
fromR :: ExpQ -> RangeQ
fromR ExpQ
x = do { Exp
a <- ExpQ
x; Range -> RangeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Range
FromR Exp
a) }
fromThenR :: ExpQ -> ExpQ -> RangeQ
fromThenR :: ExpQ -> ExpQ -> RangeQ
fromThenR ExpQ
x ExpQ
y = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Range -> RangeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Range
FromThenR Exp
a Exp
b) }
fromToR :: ExpQ -> ExpQ -> RangeQ
fromToR :: ExpQ -> ExpQ -> RangeQ
fromToR ExpQ
x ExpQ
y = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Range -> RangeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Range
FromToR Exp
a Exp
b) }
fromThenToR :: ExpQ -> ExpQ -> ExpQ -> RangeQ
fromThenToR :: ExpQ -> ExpQ -> ExpQ -> RangeQ
fromThenToR ExpQ
x ExpQ
y ExpQ
z = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp
c <- ExpQ
z;
Range -> RangeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Exp -> Range
FromThenToR Exp
a Exp
b Exp
c) }
normalB :: ExpQ -> BodyQ
normalB :: ExpQ -> BodyQ
normalB ExpQ
e = do { Exp
e1 <- ExpQ
e; Body -> BodyQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Body
NormalB Exp
e1) }
guardedB :: [Q (Guard,Exp)] -> BodyQ
guardedB :: [Q (Guard, Exp)] -> BodyQ
guardedB [Q (Guard, Exp)]
ges = do { [(Guard, Exp)]
ges' <- [Q (Guard, Exp)] -> Q [(Guard, Exp)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Q (Guard, Exp)]
ges; Body -> BodyQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([(Guard, Exp)] -> Body
GuardedB [(Guard, Exp)]
ges') }
normalG :: ExpQ -> GuardQ
normalG :: ExpQ -> GuardQ
normalG ExpQ
e = do { Exp
e1 <- ExpQ
e; Guard -> GuardQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Guard
NormalG Exp
e1) }
normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)
normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)
normalGE ExpQ
g ExpQ
e = do { Exp
g1 <- ExpQ
g; Exp
e1 <- ExpQ
e; (Guard, Exp) -> Q (Guard, Exp)
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Guard
NormalG Exp
g1, Exp
e1) }
patG :: [StmtQ] -> GuardQ
patG :: [StmtQ] -> GuardQ
patG [StmtQ]
ss = do { [Stmt]
ss' <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss; Guard -> GuardQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Guard
PatG [Stmt]
ss') }
patGE :: [StmtQ] -> ExpQ -> Q (Guard, Exp)
patGE :: [StmtQ] -> ExpQ -> Q (Guard, Exp)
patGE [StmtQ]
ss ExpQ
e = do { [Stmt]
ss' <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss;
Exp
e' <- ExpQ
e;
(Guard, Exp) -> Q (Guard, Exp)
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Guard
PatG [Stmt]
ss', Exp
e') }
match :: PatQ -> BodyQ -> [DecQ] -> MatchQ
match :: PatQ -> BodyQ -> [DecQ] -> MatchQ
match PatQ
p BodyQ
rhs [DecQ]
ds = do { Pat
p' <- PatQ
p;
Body
r' <- BodyQ
rhs;
[Dec]
ds' <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
ds;
Match -> MatchQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Body -> [Dec] -> Match
Match Pat
p' Body
r' [Dec]
ds') }
clause :: [PatQ] -> BodyQ -> [DecQ] -> ClauseQ
clause :: [PatQ] -> BodyQ -> [DecQ] -> ClauseQ
clause [PatQ]
ps BodyQ
r [DecQ]
ds = do { [Pat]
ps' <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps;
Body
r' <- BodyQ
r;
[Dec]
ds' <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
ds;
Clause -> ClauseQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
ps' Body
r' [Dec]
ds') }
dyn :: String -> ExpQ
dyn :: String -> ExpQ
dyn String
s = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Exp
VarE (String -> Name
mkName String
s))
varE :: Name -> ExpQ
varE :: Name -> ExpQ
varE Name
s = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Exp
VarE Name
s)
conE :: Name -> ExpQ
conE :: Name -> ExpQ
conE Name
s = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Exp
ConE Name
s)
litE :: Lit -> ExpQ
litE :: Lit -> ExpQ
litE Lit
c = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Lit -> Exp
LitE Lit
c)
appE :: ExpQ -> ExpQ -> ExpQ
appE :: ExpQ -> ExpQ -> ExpQ
appE ExpQ
x ExpQ
y = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Exp
AppE Exp
a Exp
b)}
appTypeE :: ExpQ -> TypeQ -> ExpQ
appTypeE :: ExpQ -> TypeQ -> ExpQ
appTypeE ExpQ
x TypeQ
t = do { Exp
a <- ExpQ
x; Type
s <- TypeQ
t; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Type -> Exp
AppTypeE Exp
a Type
s) }
parensE :: ExpQ -> ExpQ
parensE :: ExpQ -> ExpQ
parensE ExpQ
x = do { Exp
x' <- ExpQ
x; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp
ParensE Exp
x') }
uInfixE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
uInfixE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
uInfixE ExpQ
x ExpQ
s ExpQ
y = do { Exp
x' <- ExpQ
x; Exp
s' <- ExpQ
s; Exp
y' <- ExpQ
y;
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Exp -> Exp
UInfixE Exp
x' Exp
s' Exp
y') }
infixE :: Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
infixE :: Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
infixE (Just ExpQ
x) ExpQ
s (Just ExpQ
y) = do { Exp
a <- ExpQ
x; Exp
s' <- ExpQ
s; Exp
b <- ExpQ
y;
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE (Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
a) Exp
s' (Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
b))}
infixE Maybe ExpQ
Nothing ExpQ
s (Just ExpQ
y) = do { Exp
s' <- ExpQ
s; Exp
b <- ExpQ
y;
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE Maybe Exp
forall a. Maybe a
Nothing Exp
s' (Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
b))}
infixE (Just ExpQ
x) ExpQ
s Maybe ExpQ
Nothing = do { Exp
a <- ExpQ
x; Exp
s' <- ExpQ
s;
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE (Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
a) Exp
s' Maybe Exp
forall a. Maybe a
Nothing)}
infixE Maybe ExpQ
Nothing ExpQ
s Maybe ExpQ
Nothing = do { Exp
s' <- ExpQ
s; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE Maybe Exp
forall a. Maybe a
Nothing Exp
s' Maybe Exp
forall a. Maybe a
Nothing) }
infixApp :: ExpQ -> ExpQ -> ExpQ -> ExpQ
infixApp :: ExpQ -> ExpQ -> ExpQ -> ExpQ
infixApp ExpQ
x ExpQ
y ExpQ
z = Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
infixE (ExpQ -> Maybe ExpQ
forall a. a -> Maybe a
Just ExpQ
x) ExpQ
y (ExpQ -> Maybe ExpQ
forall a. a -> Maybe a
Just ExpQ
z)
sectionL :: ExpQ -> ExpQ -> ExpQ
sectionL :: ExpQ -> ExpQ -> ExpQ
sectionL ExpQ
x ExpQ
y = Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
infixE (ExpQ -> Maybe ExpQ
forall a. a -> Maybe a
Just ExpQ
x) ExpQ
y Maybe ExpQ
forall a. Maybe a
Nothing
sectionR :: ExpQ -> ExpQ -> ExpQ
sectionR :: ExpQ -> ExpQ -> ExpQ
sectionR ExpQ
x ExpQ
y = Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
infixE Maybe ExpQ
forall a. Maybe a
Nothing ExpQ
x (ExpQ -> Maybe ExpQ
forall a. a -> Maybe a
Just ExpQ
y)
lamE :: [PatQ] -> ExpQ -> ExpQ
lamE :: [PatQ] -> ExpQ -> ExpQ
lamE [PatQ]
ps ExpQ
e = do [Pat]
ps' <- [PatQ] -> Q [Pat]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [PatQ]
ps
Exp
e' <- ExpQ
e
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Pat] -> Exp -> Exp
LamE [Pat]
ps' Exp
e')
lam1E :: PatQ -> ExpQ -> ExpQ
lam1E :: PatQ -> ExpQ -> ExpQ
lam1E PatQ
p ExpQ
e = [PatQ] -> ExpQ -> ExpQ
lamE [PatQ
p] ExpQ
e
lamCaseE :: [MatchQ] -> ExpQ
lamCaseE :: [MatchQ] -> ExpQ
lamCaseE [MatchQ]
ms = [MatchQ] -> Q [Match]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [MatchQ]
ms Q [Match] -> ([Match] -> ExpQ) -> ExpQ
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> ExpQ) -> ([Match] -> Exp) -> [Match] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Match] -> Exp
LamCaseE
tupE :: [Maybe ExpQ] -> ExpQ
tupE :: [Maybe ExpQ] -> ExpQ
tupE [Maybe ExpQ]
es = do { [Maybe Exp]
es1 <- (Maybe ExpQ -> Q (Maybe Exp)) -> [Maybe ExpQ] -> Q [Maybe Exp]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Maybe ExpQ -> Q (Maybe Exp)
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Maybe ExpQ]
es; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Maybe Exp] -> Exp
TupE [Maybe Exp]
es1)}
unboxedTupE :: [Maybe ExpQ] -> ExpQ
unboxedTupE :: [Maybe ExpQ] -> ExpQ
unboxedTupE [Maybe ExpQ]
es = do { [Maybe Exp]
es1 <- (Maybe ExpQ -> Q (Maybe Exp)) -> [Maybe ExpQ] -> Q [Maybe Exp]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Maybe ExpQ -> Q (Maybe Exp)
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Maybe ExpQ]
es; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Maybe Exp] -> Exp
UnboxedTupE [Maybe Exp]
es1)}
unboxedSumE :: ExpQ -> SumAlt -> SumArity -> ExpQ
unboxedSumE :: ExpQ -> SumAlt -> SumAlt -> ExpQ
unboxedSumE ExpQ
e SumAlt
alt SumAlt
arity = do { Exp
e1 <- ExpQ
e; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> SumAlt -> SumAlt -> Exp
UnboxedSumE Exp
e1 SumAlt
alt SumAlt
arity) }
condE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
condE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
condE ExpQ
x ExpQ
y ExpQ
z = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp
c <- ExpQ
z; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Exp -> Exp -> Exp
CondE Exp
a Exp
b Exp
c)}
multiIfE :: [Q (Guard, Exp)] -> ExpQ
multiIfE :: [Q (Guard, Exp)] -> ExpQ
multiIfE [Q (Guard, Exp)]
alts = [Q (Guard, Exp)] -> Q [(Guard, Exp)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Q (Guard, Exp)]
alts Q [(Guard, Exp)] -> ([(Guard, Exp)] -> ExpQ) -> ExpQ
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> ExpQ) -> ([(Guard, Exp)] -> Exp) -> [(Guard, Exp)] -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Guard, Exp)] -> Exp
MultiIfE
letE :: [DecQ] -> ExpQ -> ExpQ
letE :: [DecQ] -> ExpQ -> ExpQ
letE [DecQ]
ds ExpQ
e = do { [Dec]
ds2 <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
ds; Exp
e2 <- ExpQ
e; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Dec] -> Exp -> Exp
LetE [Dec]
ds2 Exp
e2) }
caseE :: ExpQ -> [MatchQ] -> ExpQ
caseE :: ExpQ -> [MatchQ] -> ExpQ
caseE ExpQ
e [MatchQ]
ms = do { Exp
e1 <- ExpQ
e; [Match]
ms1 <- [MatchQ] -> Q [Match]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [MatchQ]
ms; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> [Match] -> Exp
CaseE Exp
e1 [Match]
ms1) }
doE :: [StmtQ] -> ExpQ
doE :: [StmtQ] -> ExpQ
doE [StmtQ]
ss = do { [Stmt]
ss1 <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Exp
DoE [Stmt]
ss1) }
mdoE :: [StmtQ] -> ExpQ
mdoE :: [StmtQ] -> ExpQ
mdoE [StmtQ]
ss = do { [Stmt]
ss1 <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Exp
MDoE [Stmt]
ss1) }
compE :: [StmtQ] -> ExpQ
compE :: [StmtQ] -> ExpQ
compE [StmtQ]
ss = do { [Stmt]
ss1 <- [StmtQ] -> Q [Stmt]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [StmtQ]
ss; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Stmt] -> Exp
CompE [Stmt]
ss1) }
arithSeqE :: RangeQ -> ExpQ
arithSeqE :: RangeQ -> ExpQ
arithSeqE RangeQ
r = do { Range
r' <- RangeQ
r; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> Exp
ArithSeqE Range
r') }
listE :: [ExpQ] -> ExpQ
listE :: [ExpQ] -> ExpQ
listE [ExpQ]
es = do { [Exp]
es1 <- [ExpQ] -> Q [Exp]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [ExpQ]
es; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Exp] -> Exp
ListE [Exp]
es1) }
sigE :: ExpQ -> TypeQ -> ExpQ
sigE :: ExpQ -> TypeQ -> ExpQ
sigE ExpQ
e TypeQ
t = do { Exp
e1 <- ExpQ
e; Type
t1 <- TypeQ
t; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> Type -> Exp
SigE Exp
e1 Type
t1) }
recConE :: Name -> [Q (Name,Exp)] -> ExpQ
recConE :: Name -> [Q (Name, Exp)] -> ExpQ
recConE Name
c [Q (Name, Exp)]
fs = do { [(Name, Exp)]
flds <- [Q (Name, Exp)] -> Q [(Name, Exp)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Q (Name, Exp)]
fs; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> [(Name, Exp)] -> Exp
RecConE Name
c [(Name, Exp)]
flds) }
recUpdE :: ExpQ -> [Q (Name,Exp)] -> ExpQ
recUpdE :: ExpQ -> [Q (Name, Exp)] -> ExpQ
recUpdE ExpQ
e [Q (Name, Exp)]
fs = do { Exp
e1 <- ExpQ
e; [(Name, Exp)]
flds <- [Q (Name, Exp)] -> Q [(Name, Exp)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Q (Name, Exp)]
fs; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Exp -> [(Name, Exp)] -> Exp
RecUpdE Exp
e1 [(Name, Exp)]
flds) }
stringE :: String -> ExpQ
stringE :: String -> ExpQ
stringE = Lit -> ExpQ
litE (Lit -> ExpQ) -> (String -> Lit) -> String -> ExpQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Lit
stringL
fieldExp :: Name -> ExpQ -> Q (Name, Exp)
fieldExp :: Name -> ExpQ -> Q (Name, Exp)
fieldExp Name
s ExpQ
e = do { Exp
e' <- ExpQ
e; (Name, Exp) -> Q (Name, Exp)
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
s,Exp
e') }
staticE :: ExpQ -> ExpQ
staticE :: ExpQ -> ExpQ
staticE = (Exp -> Exp) -> ExpQ -> ExpQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Exp -> Exp
StaticE
unboundVarE :: Name -> ExpQ
unboundVarE :: Name -> ExpQ
unboundVarE Name
s = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> Exp
UnboundVarE Name
s)
labelE :: String -> ExpQ
labelE :: String -> ExpQ
labelE String
s = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> Exp
LabelE String
s)
implicitParamVarE :: String -> ExpQ
implicitParamVarE :: String -> ExpQ
implicitParamVarE String
n = Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> Exp
ImplicitParamVarE String
n)
fromE :: ExpQ -> ExpQ
fromE :: ExpQ -> ExpQ
fromE ExpQ
x = do { Exp
a <- ExpQ
x; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> Exp
ArithSeqE (Exp -> Range
FromR Exp
a)) }
fromThenE :: ExpQ -> ExpQ -> ExpQ
fromThenE :: ExpQ -> ExpQ -> ExpQ
fromThenE ExpQ
x ExpQ
y = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> Exp
ArithSeqE (Exp -> Exp -> Range
FromThenR Exp
a Exp
b)) }
fromToE :: ExpQ -> ExpQ -> ExpQ
fromToE :: ExpQ -> ExpQ -> ExpQ
fromToE ExpQ
x ExpQ
y = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> Exp
ArithSeqE (Exp -> Exp -> Range
FromToR Exp
a Exp
b)) }
fromThenToE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
fromThenToE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
fromThenToE ExpQ
x ExpQ
y ExpQ
z = do { Exp
a <- ExpQ
x; Exp
b <- ExpQ
y; Exp
c <- ExpQ
z;
Exp -> ExpQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Range -> Exp
ArithSeqE (Exp -> Exp -> Exp -> Range
FromThenToR Exp
a Exp
b Exp
c)) }
valD :: PatQ -> BodyQ -> [DecQ] -> DecQ
valD :: PatQ -> BodyQ -> [DecQ] -> DecQ
valD PatQ
p BodyQ
b [DecQ]
ds =
do { Pat
p' <- PatQ
p
; [Dec]
ds' <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
ds
; Body
b' <- BodyQ
b
; Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Pat -> Body -> [Dec] -> Dec
ValD Pat
p' Body
b' [Dec]
ds')
}
funD :: Name -> [ClauseQ] -> DecQ
funD :: Name -> [ClauseQ] -> DecQ
funD Name
nm [ClauseQ]
cs =
do { [Clause]
cs1 <- [ClauseQ] -> Q [Clause]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [ClauseQ]
cs
; Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> [Clause] -> Dec
FunD Name
nm [Clause]
cs1)
}
tySynD :: Name -> [TyVarBndrQ] -> TypeQ -> DecQ
tySynD :: Name -> [TyVarBndrQ] -> TypeQ -> DecQ
tySynD Name
tc [TyVarBndrQ]
tvs TypeQ
rhs =
do { [TyVarBndr]
tvs1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
; Type
rhs1 <- TypeQ
rhs
; Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> [TyVarBndr] -> Type -> Dec
TySynD Name
tc [TyVarBndr]
tvs1 Type
rhs1)
}
dataD :: CxtQ -> Name -> [TyVarBndrQ] -> Maybe KindQ -> [ConQ]
-> [DerivClauseQ] -> DecQ
dataD :: CxtQ
-> Name
-> [TyVarBndrQ]
-> Maybe TypeQ
-> [ConQ]
-> [DerivClauseQ]
-> DecQ
dataD CxtQ
ctxt Name
tc [TyVarBndrQ]
tvs Maybe TypeQ
ksig [ConQ]
cons [DerivClauseQ]
derivs =
do
Cxt
ctxt1 <- CxtQ
ctxt
[TyVarBndr]
tvs1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
Maybe Type
ksig1 <- Maybe TypeQ -> Q (Maybe Type)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe TypeQ
ksig
[Con]
cons1 <- [ConQ] -> Q [Con]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [ConQ]
cons
[DerivClause]
derivs1 <- [DerivClauseQ] -> Q [DerivClause]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DerivClauseQ]
derivs
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Cxt
-> Name
-> [TyVarBndr]
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataD Cxt
ctxt1 Name
tc [TyVarBndr]
tvs1 Maybe Type
ksig1 [Con]
cons1 [DerivClause]
derivs1)
newtypeD :: CxtQ -> Name -> [TyVarBndrQ] -> Maybe KindQ -> ConQ
-> [DerivClauseQ] -> DecQ
newtypeD :: CxtQ
-> Name
-> [TyVarBndrQ]
-> Maybe TypeQ
-> ConQ
-> [DerivClauseQ]
-> DecQ
newtypeD CxtQ
ctxt Name
tc [TyVarBndrQ]
tvs Maybe TypeQ
ksig ConQ
con [DerivClauseQ]
derivs =
do
Cxt
ctxt1 <- CxtQ
ctxt
[TyVarBndr]
tvs1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
Maybe Type
ksig1 <- Maybe TypeQ -> Q (Maybe Type)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe TypeQ
ksig
Con
con1 <- ConQ
con
[DerivClause]
derivs1 <- [DerivClauseQ] -> Q [DerivClause]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DerivClauseQ]
derivs
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Cxt
-> Name -> [TyVarBndr] -> Maybe Type -> Con -> [DerivClause] -> Dec
NewtypeD Cxt
ctxt1 Name
tc [TyVarBndr]
tvs1 Maybe Type
ksig1 Con
con1 [DerivClause]
derivs1)
classD :: CxtQ -> Name -> [TyVarBndrQ] -> [FunDep] -> [DecQ] -> DecQ
classD :: CxtQ -> Name -> [TyVarBndrQ] -> [FunDep] -> [DecQ] -> DecQ
classD CxtQ
ctxt Name
cls [TyVarBndrQ]
tvs [FunDep]
fds [DecQ]
decs =
do
[TyVarBndr]
tvs1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
[Dec]
decs1 <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [DecQ]
decs
Cxt
ctxt1 <- CxtQ
ctxt
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Cxt -> Name -> [TyVarBndr] -> [FunDep] -> [Dec] -> Dec
ClassD Cxt
ctxt1 Name
cls [TyVarBndr]
tvs1 [FunDep]
fds [Dec]
decs1
instanceD :: CxtQ -> TypeQ -> [DecQ] -> DecQ
instanceD :: CxtQ -> TypeQ -> [DecQ] -> DecQ
instanceD = Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ
instanceWithOverlapD Maybe Overlap
forall a. Maybe a
Nothing
instanceWithOverlapD :: Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ
instanceWithOverlapD :: Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ
instanceWithOverlapD Maybe Overlap
o CxtQ
ctxt TypeQ
ty [DecQ]
decs =
do
Cxt
ctxt1 <- CxtQ
ctxt
[Dec]
decs1 <- [DecQ] -> Q [Dec]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DecQ]
decs
Type
ty1 <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec
InstanceD Maybe Overlap
o Cxt
ctxt1 Type
ty1 [Dec]
decs1
sigD :: Name -> TypeQ -> DecQ
sigD :: Name -> TypeQ -> DecQ
sigD Name
fun TypeQ
ty = (Type -> Dec) -> TypeQ -> DecQ
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Name -> Type -> Dec
SigD Name
fun) (TypeQ -> DecQ) -> TypeQ -> DecQ
forall a b. (a -> b) -> a -> b
$ TypeQ
ty
kiSigD :: Name -> KindQ -> DecQ
kiSigD :: Name -> TypeQ -> DecQ
kiSigD Name
fun TypeQ
ki = (Type -> Dec) -> TypeQ -> DecQ
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Name -> Type -> Dec
KiSigD Name
fun) (TypeQ -> DecQ) -> TypeQ -> DecQ
forall a b. (a -> b) -> a -> b
$ TypeQ
ki
forImpD :: Callconv -> Safety -> String -> Name -> TypeQ -> DecQ
forImpD :: Callconv -> Safety -> String -> Name -> TypeQ -> DecQ
forImpD Callconv
cc Safety
s String
str Name
n TypeQ
ty
= do Type
ty' <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Foreign -> Dec
ForeignD (Callconv -> Safety -> String -> Name -> Type -> Foreign
ImportF Callconv
cc Safety
s String
str Name
n Type
ty')
infixLD :: Int -> Name -> DecQ
infixLD :: SumAlt -> Name -> DecQ
infixLD SumAlt
prec Name
nm = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Fixity -> Name -> Dec
InfixD (SumAlt -> FixityDirection -> Fixity
Fixity SumAlt
prec FixityDirection
InfixL) Name
nm)
infixRD :: Int -> Name -> DecQ
infixRD :: SumAlt -> Name -> DecQ
infixRD SumAlt
prec Name
nm = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Fixity -> Name -> Dec
InfixD (SumAlt -> FixityDirection -> Fixity
Fixity SumAlt
prec FixityDirection
InfixR) Name
nm)
infixND :: Int -> Name -> DecQ
infixND :: SumAlt -> Name -> DecQ
infixND SumAlt
prec Name
nm = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Fixity -> Name -> Dec
InfixD (SumAlt -> FixityDirection -> Fixity
Fixity SumAlt
prec FixityDirection
InfixN) Name
nm)
pragInlD :: Name -> Inline -> RuleMatch -> Phases -> DecQ
pragInlD :: Name -> Inline -> RuleMatch -> Phases -> DecQ
pragInlD Name
name Inline
inline RuleMatch
rm Phases
phases
= Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ Name -> Inline -> RuleMatch -> Phases -> Pragma
InlineP Name
name Inline
inline RuleMatch
rm Phases
phases
pragSpecD :: Name -> TypeQ -> Phases -> DecQ
pragSpecD :: Name -> TypeQ -> Phases -> DecQ
pragSpecD Name
n TypeQ
ty Phases
phases
= do
Type
ty1 <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseP Name
n Type
ty1 Maybe Inline
forall a. Maybe a
Nothing Phases
phases
pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ
pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ
pragSpecInlD Name
n TypeQ
ty Inline
inline Phases
phases
= do
Type
ty1 <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseP Name
n Type
ty1 (Inline -> Maybe Inline
forall a. a -> Maybe a
Just Inline
inline) Phases
phases
pragSpecInstD :: TypeQ -> DecQ
pragSpecInstD :: TypeQ -> DecQ
pragSpecInstD TypeQ
ty
= do
Type
ty1 <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ Type -> Pragma
SpecialiseInstP Type
ty1
pragRuleD :: String -> Maybe [TyVarBndrQ] -> [RuleBndrQ] -> ExpQ -> ExpQ
-> Phases -> DecQ
pragRuleD :: String
-> Maybe [TyVarBndrQ]
-> [RuleBndrQ]
-> ExpQ
-> ExpQ
-> Phases
-> DecQ
pragRuleD String
n Maybe [TyVarBndrQ]
ty_bndrs [RuleBndrQ]
tm_bndrs ExpQ
lhs ExpQ
rhs Phases
phases
= do
Maybe [TyVarBndr]
ty_bndrs1 <- ([TyVarBndrQ] -> Q [TyVarBndr])
-> Maybe [TyVarBndrQ] -> Q (Maybe [TyVarBndr])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence Maybe [TyVarBndrQ]
ty_bndrs
[RuleBndr]
tm_bndrs1 <- [RuleBndrQ] -> Q [RuleBndr]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [RuleBndrQ]
tm_bndrs
Exp
lhs1 <- ExpQ
lhs
Exp
rhs1 <- ExpQ
rhs
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ String
-> Maybe [TyVarBndr]
-> [RuleBndr]
-> Exp
-> Exp
-> Phases
-> Pragma
RuleP String
n Maybe [TyVarBndr]
ty_bndrs1 [RuleBndr]
tm_bndrs1 Exp
lhs1 Exp
rhs1 Phases
phases
pragAnnD :: AnnTarget -> ExpQ -> DecQ
pragAnnD :: AnnTarget -> ExpQ -> DecQ
pragAnnD AnnTarget
target ExpQ
expr
= do
Exp
exp1 <- ExpQ
expr
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ AnnTarget -> Exp -> Pragma
AnnP AnnTarget
target Exp
exp1
pragLineD :: Int -> String -> DecQ
pragLineD :: SumAlt -> String -> DecQ
pragLineD SumAlt
line String
file = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ SumAlt -> String -> Pragma
LineP SumAlt
line String
file
pragCompleteD :: [Name] -> Maybe Name -> DecQ
pragCompleteD :: [Name] -> Maybe Name -> DecQ
pragCompleteD [Name]
cls Maybe Name
mty = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD (Pragma -> Dec) -> Pragma -> Dec
forall a b. (a -> b) -> a -> b
$ [Name] -> Maybe Name -> Pragma
CompleteP [Name]
cls Maybe Name
mty
dataInstD :: CxtQ -> (Maybe [TyVarBndrQ]) -> TypeQ -> Maybe KindQ -> [ConQ]
-> [DerivClauseQ] -> DecQ
dataInstD :: CxtQ
-> Maybe [TyVarBndrQ]
-> TypeQ
-> Maybe TypeQ
-> [ConQ]
-> [DerivClauseQ]
-> DecQ
dataInstD CxtQ
ctxt Maybe [TyVarBndrQ]
mb_bndrs TypeQ
ty Maybe TypeQ
ksig [ConQ]
cons [DerivClauseQ]
derivs =
do
Cxt
ctxt1 <- CxtQ
ctxt
Maybe [TyVarBndr]
mb_bndrs1 <- ([TyVarBndrQ] -> Q [TyVarBndr])
-> Maybe [TyVarBndrQ] -> Q (Maybe [TyVarBndr])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence Maybe [TyVarBndrQ]
mb_bndrs
Type
ty1 <- TypeQ
ty
Maybe Type
ksig1 <- Maybe TypeQ -> Q (Maybe Type)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe TypeQ
ksig
[Con]
cons1 <- [ConQ] -> Q [Con]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [ConQ]
cons
[DerivClause]
derivs1 <- [DerivClauseQ] -> Q [DerivClause]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [DerivClauseQ]
derivs
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Cxt
-> Maybe [TyVarBndr]
-> Type
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataInstD Cxt
ctxt1 Maybe [TyVarBndr]
mb_bndrs1 Type
ty1 Maybe Type
ksig1 [Con]
cons1 [DerivClause]
derivs1)
newtypeInstD :: CxtQ -> (Maybe [TyVarBndrQ]) -> TypeQ -> Maybe KindQ -> ConQ
-> [DerivClauseQ] -> DecQ
newtypeInstD :: CxtQ
-> Maybe [TyVarBndrQ]
-> TypeQ
-> Maybe TypeQ
-> ConQ
-> [DerivClauseQ]
-> DecQ
newtypeInstD CxtQ
ctxt Maybe [TyVarBndrQ]
mb_bndrs TypeQ
ty Maybe TypeQ
ksig ConQ
con [DerivClauseQ]
derivs =
do
Cxt
ctxt1 <- CxtQ
ctxt
Maybe [TyVarBndr]
mb_bndrs1 <- ([TyVarBndrQ] -> Q [TyVarBndr])
-> Maybe [TyVarBndrQ] -> Q (Maybe [TyVarBndr])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence Maybe [TyVarBndrQ]
mb_bndrs
Type
ty1 <- TypeQ
ty
Maybe Type
ksig1 <- Maybe TypeQ -> Q (Maybe Type)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe TypeQ
ksig
Con
con1 <- ConQ
con
[DerivClause]
derivs1 <- [DerivClauseQ] -> Q [DerivClause]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [DerivClauseQ]
derivs
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Cxt
-> Maybe [TyVarBndr]
-> Type
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeInstD Cxt
ctxt1 Maybe [TyVarBndr]
mb_bndrs1 Type
ty1 Maybe Type
ksig1 Con
con1 [DerivClause]
derivs1)
tySynInstD :: TySynEqnQ -> DecQ
tySynInstD :: TySynEqnQ -> DecQ
tySynInstD TySynEqnQ
eqn =
do
TySynEqn
eqn1 <- TySynEqnQ
eqn
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (TySynEqn -> Dec
TySynInstD TySynEqn
eqn1)
dataFamilyD :: Name -> [TyVarBndrQ] -> Maybe KindQ -> DecQ
dataFamilyD :: Name -> [TyVarBndrQ] -> Maybe TypeQ -> DecQ
dataFamilyD Name
tc [TyVarBndrQ]
tvs Maybe TypeQ
kind =
do [TyVarBndr]
tvs' <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
Maybe Type
kind' <- Maybe TypeQ -> Q (Maybe Type)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe TypeQ
kind
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Name -> [TyVarBndr] -> Maybe Type -> Dec
DataFamilyD Name
tc [TyVarBndr]
tvs' Maybe Type
kind'
openTypeFamilyD :: Name -> [TyVarBndrQ] -> FamilyResultSigQ
-> Maybe InjectivityAnn -> DecQ
openTypeFamilyD :: Name
-> [TyVarBndrQ] -> FamilyResultSigQ -> Maybe InjectivityAnn -> DecQ
openTypeFamilyD Name
tc [TyVarBndrQ]
tvs FamilyResultSigQ
res Maybe InjectivityAnn
inj =
do [TyVarBndr]
tvs' <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
FamilyResultSig
res' <- FamilyResultSigQ
res
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ TypeFamilyHead -> Dec
OpenTypeFamilyD (Name
-> [TyVarBndr]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
tc [TyVarBndr]
tvs' FamilyResultSig
res' Maybe InjectivityAnn
inj)
closedTypeFamilyD :: Name -> [TyVarBndrQ] -> FamilyResultSigQ
-> Maybe InjectivityAnn -> [TySynEqnQ] -> DecQ
closedTypeFamilyD :: Name
-> [TyVarBndrQ]
-> FamilyResultSigQ
-> Maybe InjectivityAnn
-> [TySynEqnQ]
-> DecQ
closedTypeFamilyD Name
tc [TyVarBndrQ]
tvs FamilyResultSigQ
result Maybe InjectivityAnn
injectivity [TySynEqnQ]
eqns =
do [TyVarBndr]
tvs1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvs
FamilyResultSig
result1 <- FamilyResultSigQ
result
[TySynEqn]
eqns1 <- [TySynEqnQ] -> Q [TySynEqn]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TySynEqnQ]
eqns
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (TypeFamilyHead -> [TySynEqn] -> Dec
ClosedTypeFamilyD (Name
-> [TyVarBndr]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
tc [TyVarBndr]
tvs1 FamilyResultSig
result1 Maybe InjectivityAnn
injectivity) [TySynEqn]
eqns1)
roleAnnotD :: Name -> [Role] -> DecQ
roleAnnotD :: Name -> [Role] -> DecQ
roleAnnotD Name
name [Role]
roles = Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Name -> [Role] -> Dec
RoleAnnotD Name
name [Role]
roles
standaloneDerivD :: CxtQ -> TypeQ -> DecQ
standaloneDerivD :: CxtQ -> TypeQ -> DecQ
standaloneDerivD = Maybe DerivStrategyQ -> CxtQ -> TypeQ -> DecQ
standaloneDerivWithStrategyD Maybe DerivStrategyQ
forall a. Maybe a
Nothing
standaloneDerivWithStrategyD :: Maybe DerivStrategyQ -> CxtQ -> TypeQ -> DecQ
standaloneDerivWithStrategyD :: Maybe DerivStrategyQ -> CxtQ -> TypeQ -> DecQ
standaloneDerivWithStrategyD Maybe DerivStrategyQ
mdsq CxtQ
ctxtq TypeQ
tyq =
do
Maybe DerivStrategy
mds <- Maybe DerivStrategyQ -> Q (Maybe DerivStrategy)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe DerivStrategyQ
mdsq
Cxt
ctxt <- CxtQ
ctxtq
Type
ty <- TypeQ
tyq
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Maybe DerivStrategy -> Cxt -> Type -> Dec
StandaloneDerivD Maybe DerivStrategy
mds Cxt
ctxt Type
ty
defaultSigD :: Name -> TypeQ -> DecQ
defaultSigD :: Name -> TypeQ -> DecQ
defaultSigD Name
n TypeQ
tyq =
do
Type
ty <- TypeQ
tyq
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Name -> Type -> Dec
DefaultSigD Name
n Type
ty
patSynD :: Name -> PatSynArgsQ -> PatSynDirQ -> PatQ -> DecQ
patSynD :: Name -> PatSynArgsQ -> PatSynDirQ -> PatQ -> DecQ
patSynD Name
name PatSynArgsQ
args PatSynDirQ
dir PatQ
pat = do
PatSynArgs
args' <- PatSynArgsQ
args
PatSynDir
dir' <- PatSynDirQ
dir
Pat
pat' <- PatQ
pat
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name -> PatSynArgs -> PatSynDir -> Pat -> Dec
PatSynD Name
name PatSynArgs
args' PatSynDir
dir' Pat
pat')
patSynSigD :: Name -> TypeQ -> DecQ
patSynSigD :: Name -> TypeQ -> DecQ
patSynSigD Name
nm TypeQ
ty =
do Type
ty' <- TypeQ
ty
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ Name -> Type -> Dec
PatSynSigD Name
nm Type
ty'
implicitParamBindD :: String -> ExpQ -> DecQ
implicitParamBindD :: String -> ExpQ -> DecQ
implicitParamBindD String
n ExpQ
e =
do
Exp
e' <- ExpQ
e
Dec -> DecQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Dec -> DecQ) -> Dec -> DecQ
forall a b. (a -> b) -> a -> b
$ String -> Exp -> Dec
ImplicitParamBindD String
n Exp
e'
tySynEqn :: (Maybe [TyVarBndrQ]) -> TypeQ -> TypeQ -> TySynEqnQ
tySynEqn :: Maybe [TyVarBndrQ] -> TypeQ -> TypeQ -> TySynEqnQ
tySynEqn Maybe [TyVarBndrQ]
mb_bndrs TypeQ
lhs TypeQ
rhs =
do
Maybe [TyVarBndr]
mb_bndrs1 <- ([TyVarBndrQ] -> Q [TyVarBndr])
-> Maybe [TyVarBndrQ] -> Q (Maybe [TyVarBndr])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence Maybe [TyVarBndrQ]
mb_bndrs
Type
lhs1 <- TypeQ
lhs
Type
rhs1 <- TypeQ
rhs
TySynEqn -> TySynEqnQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe [TyVarBndr] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr]
mb_bndrs1 Type
lhs1 Type
rhs1)
cxt :: [PredQ] -> CxtQ
cxt :: [TypeQ] -> CxtQ
cxt = [TypeQ] -> CxtQ
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence
derivClause :: Maybe DerivStrategyQ -> [PredQ] -> DerivClauseQ
derivClause :: Maybe DerivStrategyQ -> [TypeQ] -> DerivClauseQ
derivClause Maybe DerivStrategyQ
mds [TypeQ]
p = do Maybe DerivStrategy
mds' <- Maybe DerivStrategyQ -> Q (Maybe DerivStrategy)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe DerivStrategyQ
mds
Cxt
p' <- [TypeQ] -> CxtQ
cxt [TypeQ]
p
DerivClause -> DerivClauseQ
forall (m :: * -> *) a. Monad m => a -> m a
return (DerivClause -> DerivClauseQ) -> DerivClause -> DerivClauseQ
forall a b. (a -> b) -> a -> b
$ Maybe DerivStrategy -> Cxt -> DerivClause
DerivClause Maybe DerivStrategy
mds' Cxt
p'
stockStrategy :: DerivStrategyQ
stockStrategy :: DerivStrategyQ
stockStrategy = DerivStrategy -> DerivStrategyQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
StockStrategy
anyclassStrategy :: DerivStrategyQ
anyclassStrategy :: DerivStrategyQ
anyclassStrategy = DerivStrategy -> DerivStrategyQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
AnyclassStrategy
newtypeStrategy :: DerivStrategyQ
newtypeStrategy :: DerivStrategyQ
newtypeStrategy = DerivStrategy -> DerivStrategyQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
NewtypeStrategy
viaStrategy :: TypeQ -> DerivStrategyQ
viaStrategy :: TypeQ -> DerivStrategyQ
viaStrategy = (Type -> DerivStrategy) -> TypeQ -> DerivStrategyQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Type -> DerivStrategy
ViaStrategy
normalC :: Name -> [BangTypeQ] -> ConQ
normalC :: Name -> [BangTypeQ] -> ConQ
normalC Name
con [BangTypeQ]
strtys = ([BangType] -> Con) -> Q [BangType] -> ConQ
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Name -> [BangType] -> Con
NormalC Name
con) (Q [BangType] -> ConQ) -> Q [BangType] -> ConQ
forall a b. (a -> b) -> a -> b
$ [BangTypeQ] -> Q [BangType]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [BangTypeQ]
strtys
recC :: Name -> [VarBangTypeQ] -> ConQ
recC :: Name -> [VarBangTypeQ] -> ConQ
recC Name
con [VarBangTypeQ]
varstrtys = ([VarBangType] -> Con) -> Q [VarBangType] -> ConQ
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Name -> [VarBangType] -> Con
RecC Name
con) (Q [VarBangType] -> ConQ) -> Q [VarBangType] -> ConQ
forall a b. (a -> b) -> a -> b
$ [VarBangTypeQ] -> Q [VarBangType]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [VarBangTypeQ]
varstrtys
infixC :: Q (Bang, Type) -> Name -> Q (Bang, Type) -> ConQ
infixC :: BangTypeQ -> Name -> BangTypeQ -> ConQ
infixC BangTypeQ
st1 Name
con BangTypeQ
st2 = do BangType
st1' <- BangTypeQ
st1
BangType
st2' <- BangTypeQ
st2
Con -> ConQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Con -> ConQ) -> Con -> ConQ
forall a b. (a -> b) -> a -> b
$ BangType -> Name -> BangType -> Con
InfixC BangType
st1' Name
con BangType
st2'
forallC :: [TyVarBndrQ] -> CxtQ -> ConQ -> ConQ
forallC :: [TyVarBndrQ] -> CxtQ -> ConQ -> ConQ
forallC [TyVarBndrQ]
ns CxtQ
ctxt ConQ
con = do
[TyVarBndr]
ns' <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
ns
Cxt
ctxt' <- CxtQ
ctxt
Con
con' <- ConQ
con
Con -> ConQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Con -> ConQ) -> Con -> ConQ
forall a b. (a -> b) -> a -> b
$ [TyVarBndr] -> Cxt -> Con -> Con
ForallC [TyVarBndr]
ns' Cxt
ctxt' Con
con'
gadtC :: [Name] -> [StrictTypeQ] -> TypeQ -> ConQ
gadtC :: [Name] -> [BangTypeQ] -> TypeQ -> ConQ
gadtC [Name]
cons [BangTypeQ]
strtys TypeQ
ty = ([BangType] -> Type -> Con) -> Q [BangType] -> TypeQ -> ConQ
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 ([Name] -> [BangType] -> Type -> Con
GadtC [Name]
cons) ([BangTypeQ] -> Q [BangType]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [BangTypeQ]
strtys) TypeQ
ty
recGadtC :: [Name] -> [VarStrictTypeQ] -> TypeQ -> ConQ
recGadtC :: [Name] -> [VarBangTypeQ] -> TypeQ -> ConQ
recGadtC [Name]
cons [VarBangTypeQ]
varstrtys TypeQ
ty = ([VarBangType] -> Type -> Con) -> Q [VarBangType] -> TypeQ -> ConQ
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 ([Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
cons) ([VarBangTypeQ] -> Q [VarBangType]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [VarBangTypeQ]
varstrtys) TypeQ
ty
forallT :: [TyVarBndrQ] -> CxtQ -> TypeQ -> TypeQ
forallT :: [TyVarBndrQ] -> CxtQ -> TypeQ -> TypeQ
forallT [TyVarBndrQ]
tvars CxtQ
ctxt TypeQ
ty = do
[TyVarBndr]
tvars1 <- [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvars
Cxt
ctxt1 <- CxtQ
ctxt
Type
ty1 <- TypeQ
ty
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> Type -> TypeQ
forall a b. (a -> b) -> a -> b
$ [TyVarBndr] -> Cxt -> Type -> Type
ForallT [TyVarBndr]
tvars1 Cxt
ctxt1 Type
ty1
forallVisT :: [TyVarBndrQ] -> TypeQ -> TypeQ
forallVisT :: [TyVarBndrQ] -> TypeQ -> TypeQ
forallVisT [TyVarBndrQ]
tvars TypeQ
ty = [TyVarBndr] -> Type -> Type
ForallVisT ([TyVarBndr] -> Type -> Type) -> Q [TyVarBndr] -> Q (Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [TyVarBndrQ] -> Q [TyVarBndr]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [TyVarBndrQ]
tvars Q (Type -> Type) -> TypeQ -> TypeQ
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TypeQ
ty
varT :: Name -> TypeQ
varT :: Name -> TypeQ
varT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> (Name -> Type) -> Name -> TypeQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
VarT
conT :: Name -> TypeQ
conT :: Name -> TypeQ
conT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> (Name -> Type) -> Name -> TypeQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
ConT
infixT :: TypeQ -> Name -> TypeQ -> TypeQ
infixT :: TypeQ -> Name -> TypeQ -> TypeQ
infixT TypeQ
t1 Name
n TypeQ
t2 = do Type
t1' <- TypeQ
t1
Type
t2' <- TypeQ
t2
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> Name -> Type -> Type
InfixT Type
t1' Name
n Type
t2')
uInfixT :: TypeQ -> Name -> TypeQ -> TypeQ
uInfixT :: TypeQ -> Name -> TypeQ -> TypeQ
uInfixT TypeQ
t1 Name
n TypeQ
t2 = do Type
t1' <- TypeQ
t1
Type
t2' <- TypeQ
t2
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> Name -> Type -> Type
UInfixT Type
t1' Name
n Type
t2')
parensT :: TypeQ -> TypeQ
parensT :: TypeQ -> TypeQ
parensT TypeQ
t = do Type
t' <- TypeQ
t
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> Type
ParensT Type
t')
appT :: TypeQ -> TypeQ -> TypeQ
appT :: TypeQ -> TypeQ -> TypeQ
appT TypeQ
t1 TypeQ
t2 = do
Type
t1' <- TypeQ
t1
Type
t2' <- TypeQ
t2
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> Type -> TypeQ
forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
AppT Type
t1' Type
t2'
appKindT :: TypeQ -> KindQ -> TypeQ
appKindT :: TypeQ -> TypeQ -> TypeQ
appKindT TypeQ
ty TypeQ
ki = do
Type
ty' <- TypeQ
ty
Type
ki' <- TypeQ
ki
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> Type -> TypeQ
forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
AppKindT Type
ty' Type
ki'
arrowT :: TypeQ
arrowT :: TypeQ
arrowT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
ArrowT
listT :: TypeQ
listT :: TypeQ
listT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
ListT
litT :: TyLitQ -> TypeQ
litT :: TyLitQ -> TypeQ
litT TyLitQ
l = (TyLit -> Type) -> TyLitQ -> TypeQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TyLit -> Type
LitT TyLitQ
l
tupleT :: Int -> TypeQ
tupleT :: SumAlt -> TypeQ
tupleT SumAlt
i = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (SumAlt -> Type
TupleT SumAlt
i)
unboxedTupleT :: Int -> TypeQ
unboxedTupleT :: SumAlt -> TypeQ
unboxedTupleT SumAlt
i = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (SumAlt -> Type
UnboxedTupleT SumAlt
i)
unboxedSumT :: SumArity -> TypeQ
unboxedSumT :: SumAlt -> TypeQ
unboxedSumT SumAlt
arity = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (SumAlt -> Type
UnboxedSumT SumAlt
arity)
sigT :: TypeQ -> KindQ -> TypeQ
sigT :: TypeQ -> TypeQ -> TypeQ
sigT TypeQ
t TypeQ
k
= do
Type
t' <- TypeQ
t
Type
k' <- TypeQ
k
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> Type -> TypeQ
forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
SigT Type
t' Type
k'
equalityT :: TypeQ
equalityT :: TypeQ
equalityT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
EqualityT
wildCardT :: TypeQ
wildCardT :: TypeQ
wildCardT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
WildCardT
implicitParamT :: String -> TypeQ -> TypeQ
implicitParamT :: String -> TypeQ -> TypeQ
implicitParamT String
n TypeQ
t
= do
Type
t' <- TypeQ
t
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> Type -> TypeQ
forall a b. (a -> b) -> a -> b
$ String -> Type -> Type
ImplicitParamT String
n Type
t'
{-# DEPRECATED classP "As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please use 'conT' and 'appT'." #-}
classP :: Name -> [Q Type] -> Q Pred
classP :: Name -> [TypeQ] -> TypeQ
classP Name
cla [TypeQ]
tys
= do
Cxt
tysl <- [TypeQ] -> CxtQ
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [TypeQ]
tys
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return ((Type -> Type -> Type) -> Type -> Cxt -> Type
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Type -> Type -> Type
AppT (Name -> Type
ConT Name
cla) Cxt
tysl)
{-# DEPRECATED equalP "As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please see 'equalityT'." #-}
equalP :: TypeQ -> TypeQ -> PredQ
equalP :: TypeQ -> TypeQ -> TypeQ
equalP TypeQ
tleft TypeQ
tright
= do
Type
tleft1 <- TypeQ
tleft
Type
tright1 <- TypeQ
tright
Type
eqT <- TypeQ
equalityT
Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return ((Type -> Type -> Type) -> Type -> Cxt -> Type
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Type -> Type -> Type
AppT Type
eqT [Type
tleft1, Type
tright1])
promotedT :: Name -> TypeQ
promotedT :: Name -> TypeQ
promotedT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Type -> TypeQ) -> (Name -> Type) -> Name -> TypeQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
PromotedT
promotedTupleT :: Int -> TypeQ
promotedTupleT :: SumAlt -> TypeQ
promotedTupleT SumAlt
i = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (SumAlt -> Type
PromotedTupleT SumAlt
i)
promotedNilT :: TypeQ
promotedNilT :: TypeQ
promotedNilT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
PromotedNilT
promotedConsT :: TypeQ
promotedConsT :: TypeQ
promotedConsT = Type -> TypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return Type
PromotedConsT
noSourceUnpackedness, sourceNoUnpack, sourceUnpack :: SourceUnpackednessQ
noSourceUnpackedness :: SourceUnpackednessQ
noSourceUnpackedness = SourceUnpackedness -> SourceUnpackednessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceUnpackedness
NoSourceUnpackedness
sourceNoUnpack :: SourceUnpackednessQ
sourceNoUnpack = SourceUnpackedness -> SourceUnpackednessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceUnpackedness
SourceNoUnpack
sourceUnpack :: SourceUnpackednessQ
sourceUnpack = SourceUnpackedness -> SourceUnpackednessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceUnpackedness
SourceUnpack
noSourceStrictness, sourceLazy, sourceStrict :: SourceStrictnessQ
noSourceStrictness :: SourceStrictnessQ
noSourceStrictness = SourceStrictness -> SourceStrictnessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceStrictness
NoSourceStrictness
sourceLazy :: SourceStrictnessQ
sourceLazy = SourceStrictness -> SourceStrictnessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceStrictness
SourceLazy
sourceStrict :: SourceStrictnessQ
sourceStrict = SourceStrictness -> SourceStrictnessQ
forall (m :: * -> *) a. Monad m => a -> m a
return SourceStrictness
SourceStrict
{-# DEPRECATED isStrict
["Use 'bang'. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. ",
"Example usage: 'bang noSourceUnpackedness sourceStrict'"] #-}
{-# DEPRECATED notStrict
["Use 'bang'. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. ",
"Example usage: 'bang noSourceUnpackedness noSourceStrictness'"] #-}
{-# DEPRECATED unpacked
["Use 'bang'. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. ",
"Example usage: 'bang sourceUnpack sourceStrict'"] #-}
isStrict, notStrict, unpacked :: Q Strict
isStrict :: Q Strict
isStrict = SourceUnpackednessQ -> SourceStrictnessQ -> Q Strict
bang SourceUnpackednessQ
noSourceUnpackedness SourceStrictnessQ
sourceStrict
notStrict :: Q Strict
notStrict = SourceUnpackednessQ -> SourceStrictnessQ -> Q Strict
bang SourceUnpackednessQ
noSourceUnpackedness SourceStrictnessQ
noSourceStrictness
unpacked :: Q Strict
unpacked = SourceUnpackednessQ -> SourceStrictnessQ -> Q Strict
bang SourceUnpackednessQ
sourceUnpack SourceStrictnessQ
sourceStrict
bang :: SourceUnpackednessQ -> SourceStrictnessQ -> BangQ
bang :: SourceUnpackednessQ -> SourceStrictnessQ -> Q Strict
bang SourceUnpackednessQ
u SourceStrictnessQ
s = do SourceUnpackedness
u' <- SourceUnpackednessQ
u
SourceStrictness
s' <- SourceStrictnessQ
s
Strict -> Q Strict
forall (m :: * -> *) a. Monad m => a -> m a
return (SourceUnpackedness -> SourceStrictness -> Strict
Bang SourceUnpackedness
u' SourceStrictness
s')
bangType :: BangQ -> TypeQ -> BangTypeQ
bangType :: Q Strict -> TypeQ -> BangTypeQ
bangType = (Strict -> Type -> BangType) -> Q Strict -> TypeQ -> BangTypeQ
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 (,)
varBangType :: Name -> BangTypeQ -> VarBangTypeQ
varBangType :: Name -> BangTypeQ -> VarBangTypeQ
varBangType Name
v BangTypeQ
bt = do (Strict
b, Type
t) <- BangTypeQ
bt
VarBangType -> VarBangTypeQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Name
v, Strict
b, Type
t)
{-# DEPRECATED strictType
"As of @template-haskell-2.11.0.0@, 'StrictType' has been replaced by 'BangType'. Please use 'bangType' instead." #-}
strictType :: Q Strict -> TypeQ -> StrictTypeQ
strictType :: Q Strict -> TypeQ -> BangTypeQ
strictType = Q Strict -> TypeQ -> BangTypeQ
bangType
{-# DEPRECATED varStrictType
"As of @template-haskell-2.11.0.0@, 'VarStrictType' has been replaced by 'VarBangType'. Please use 'varBangType' instead." #-}
varStrictType :: Name -> StrictTypeQ -> VarStrictTypeQ
varStrictType :: Name -> BangTypeQ -> VarBangTypeQ
varStrictType = Name -> BangTypeQ -> VarBangTypeQ
varBangType
numTyLit :: Integer -> TyLitQ
numTyLit :: Integer -> TyLitQ
numTyLit Integer
n = if Integer
n Integer -> Integer -> Bool
forall a. Ord a => a -> a -> Bool
>= Integer
0 then TyLit -> TyLitQ
forall (m :: * -> *) a. Monad m => a -> m a
return (Integer -> TyLit
NumTyLit Integer
n)
else String -> TyLitQ
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"Negative type-level number: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Integer -> String
forall a. Show a => a -> String
show Integer
n)
strTyLit :: String -> TyLitQ
strTyLit :: String -> TyLitQ
strTyLit String
s = TyLit -> TyLitQ
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> TyLit
StrTyLit String
s)
plainTV :: Name -> TyVarBndrQ
plainTV :: Name -> TyVarBndrQ
plainTV = TyVarBndr -> TyVarBndrQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TyVarBndr -> TyVarBndrQ)
-> (Name -> TyVarBndr) -> Name -> TyVarBndrQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> TyVarBndr
PlainTV
kindedTV :: Name -> KindQ -> TyVarBndrQ
kindedTV :: Name -> TypeQ -> TyVarBndrQ
kindedTV Name
n = (Type -> TyVarBndr) -> TypeQ -> TyVarBndrQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Name -> Type -> TyVarBndr
KindedTV Name
n)
varK :: Name -> Kind
varK :: Name -> Type
varK = Name -> Type
VarT
conK :: Name -> Kind
conK :: Name -> Type
conK = Name -> Type
ConT
tupleK :: Int -> Kind
tupleK :: SumAlt -> Type
tupleK = SumAlt -> Type
TupleT
arrowK :: Kind
arrowK :: Type
arrowK = Type
ArrowT
listK :: Kind
listK :: Type
listK = Type
ListT
appK :: Kind -> Kind -> Kind
appK :: Type -> Type -> Type
appK = Type -> Type -> Type
AppT
starK :: KindQ
starK :: TypeQ
starK = Type -> TypeQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
StarT
constraintK :: KindQ
constraintK :: TypeQ
constraintK = Type -> TypeQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
ConstraintT
noSig :: FamilyResultSigQ
noSig :: FamilyResultSigQ
noSig = FamilyResultSig -> FamilyResultSigQ
forall (f :: * -> *) a. Applicative f => a -> f a
pure FamilyResultSig
NoSig
kindSig :: KindQ -> FamilyResultSigQ
kindSig :: TypeQ -> FamilyResultSigQ
kindSig = (Type -> FamilyResultSig) -> TypeQ -> FamilyResultSigQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Type -> FamilyResultSig
KindSig
tyVarSig :: TyVarBndrQ -> FamilyResultSigQ
tyVarSig :: TyVarBndrQ -> FamilyResultSigQ
tyVarSig = (TyVarBndr -> FamilyResultSig) -> TyVarBndrQ -> FamilyResultSigQ
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TyVarBndr -> FamilyResultSig
TyVarSig
injectivityAnn :: Name -> [Name] -> InjectivityAnn
injectivityAnn :: Name -> [Name] -> InjectivityAnn
injectivityAnn = Name -> [Name] -> InjectivityAnn
TH.InjectivityAnn
nominalR, representationalR, phantomR, inferR :: Role
nominalR :: Role
nominalR = Role
NominalR
representationalR :: Role
representationalR = Role
RepresentationalR
phantomR :: Role
phantomR = Role
PhantomR
inferR :: Role
inferR = Role
InferR
cCall, stdCall, cApi, prim, javaScript :: Callconv
cCall :: Callconv
cCall = Callconv
CCall
stdCall :: Callconv
stdCall = Callconv
StdCall
cApi :: Callconv
cApi = Callconv
CApi
prim :: Callconv
prim = Callconv
Prim
javaScript :: Callconv
javaScript = Callconv
JavaScript
unsafe, safe, interruptible :: Safety
unsafe :: Safety
unsafe = Safety
Unsafe
safe :: Safety
safe = Safety
Safe
interruptible :: Safety
interruptible = Safety
Interruptible
funDep :: [Name] -> [Name] -> FunDep
funDep :: [Name] -> [Name] -> FunDep
funDep = [Name] -> [Name] -> FunDep
FunDep
ruleVar :: Name -> RuleBndrQ
ruleVar :: Name -> RuleBndrQ
ruleVar = RuleBndr -> RuleBndrQ
forall (m :: * -> *) a. Monad m => a -> m a
return (RuleBndr -> RuleBndrQ) -> (Name -> RuleBndr) -> Name -> RuleBndrQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> RuleBndr
RuleVar
typedRuleVar :: Name -> TypeQ -> RuleBndrQ
typedRuleVar :: Name -> TypeQ -> RuleBndrQ
typedRuleVar Name
n TypeQ
ty = TypeQ
ty TypeQ -> (Type -> RuleBndrQ) -> RuleBndrQ
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= RuleBndr -> RuleBndrQ
forall (m :: * -> *) a. Monad m => a -> m a
return (RuleBndr -> RuleBndrQ) -> (Type -> RuleBndr) -> Type -> RuleBndrQ
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type -> RuleBndr
TypedRuleVar Name
n
valueAnnotation :: Name -> AnnTarget
valueAnnotation :: Name -> AnnTarget
valueAnnotation = Name -> AnnTarget
ValueAnnotation
typeAnnotation :: Name -> AnnTarget
typeAnnotation :: Name -> AnnTarget
typeAnnotation = Name -> AnnTarget
TypeAnnotation
moduleAnnotation :: AnnTarget
moduleAnnotation :: AnnTarget
moduleAnnotation = AnnTarget
ModuleAnnotation
unidir, implBidir :: PatSynDirQ
unidir :: PatSynDirQ
unidir = PatSynDir -> PatSynDirQ
forall (m :: * -> *) a. Monad m => a -> m a
return PatSynDir
Unidir
implBidir :: PatSynDirQ
implBidir = PatSynDir -> PatSynDirQ
forall (m :: * -> *) a. Monad m => a -> m a
return PatSynDir
ImplBidir
explBidir :: [ClauseQ] -> PatSynDirQ
explBidir :: [ClauseQ] -> PatSynDirQ
explBidir [ClauseQ]
cls = do
[Clause]
cls' <- [ClauseQ] -> Q [Clause]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [ClauseQ]
cls
PatSynDir -> PatSynDirQ
forall (m :: * -> *) a. Monad m => a -> m a
return ([Clause] -> PatSynDir
ExplBidir [Clause]
cls')
prefixPatSyn :: [Name] -> PatSynArgsQ
prefixPatSyn :: [Name] -> PatSynArgsQ
prefixPatSyn [Name]
args = PatSynArgs -> PatSynArgsQ
forall (m :: * -> *) a. Monad m => a -> m a
return (PatSynArgs -> PatSynArgsQ) -> PatSynArgs -> PatSynArgsQ
forall a b. (a -> b) -> a -> b
$ [Name] -> PatSynArgs
PrefixPatSyn [Name]
args
recordPatSyn :: [Name] -> PatSynArgsQ
recordPatSyn :: [Name] -> PatSynArgsQ
recordPatSyn [Name]
sels = PatSynArgs -> PatSynArgsQ
forall (m :: * -> *) a. Monad m => a -> m a
return (PatSynArgs -> PatSynArgsQ) -> PatSynArgs -> PatSynArgsQ
forall a b. (a -> b) -> a -> b
$ [Name] -> PatSynArgs
RecordPatSyn [Name]
sels
infixPatSyn :: Name -> Name -> PatSynArgsQ
infixPatSyn :: Name -> Name -> PatSynArgsQ
infixPatSyn Name
arg1 Name
arg2 = PatSynArgs -> PatSynArgsQ
forall (m :: * -> *) a. Monad m => a -> m a
return (PatSynArgs -> PatSynArgsQ) -> PatSynArgs -> PatSynArgsQ
forall a b. (a -> b) -> a -> b
$ Name -> Name -> PatSynArgs
InfixPatSyn Name
arg1 Name
arg2
appsE :: [ExpQ] -> ExpQ
appsE :: [ExpQ] -> ExpQ
appsE [] = String -> ExpQ
forall a. HasCallStack => String -> a
error String
"appsE []"
appsE [ExpQ
x] = ExpQ
x
appsE (ExpQ
x:ExpQ
y:[ExpQ]
zs) = [ExpQ] -> ExpQ
appsE ( (ExpQ -> ExpQ -> ExpQ
appE ExpQ
x ExpQ
y) ExpQ -> [ExpQ] -> [ExpQ]
forall a. a -> [a] -> [a]
: [ExpQ]
zs )
thisModule :: Q Module
thisModule :: Q Module
thisModule = do
Loc
loc <- Q Loc
location
Module -> Q Module
forall (m :: * -> *) a. Monad m => a -> m a
return (Module -> Q Module) -> Module -> Q Module
forall a b. (a -> b) -> a -> b
$ PkgName -> ModName -> Module
Module (String -> PkgName
mkPkgName (String -> PkgName) -> String -> PkgName
forall a b. (a -> b) -> a -> b
$ Loc -> String
loc_package Loc
loc) (String -> ModName
mkModName (String -> ModName) -> String -> ModName
forall a b. (a -> b) -> a -> b
$ Loc -> String
loc_module Loc
loc)