{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE Trustworthy #-}
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.Applicative(liftA, liftA2)
import qualified Data.Kind as Kind (Type)
import Data.Word( Word8 )
import Data.List.NonEmpty ( NonEmpty(..) )
import GHC.Exts (TYPE)
import Prelude
type TExpQ :: TYPE r -> Kind.Type
type TExpQ a = Q (TExp a)
type CodeQ :: TYPE r -> Kind.Type
type CodeQ = Code Q
type InfoQ = Q Info
type PatQ = Q Pat
type FieldPatQ = Q FieldPat
type ExpQ = Q Exp
type DecQ = Q Dec
type DecsQ = Q [Dec]
type Decs = [Dec]
type ConQ = Q Con
type TypeQ = Q Type
type KindQ = Q Kind
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
type TyVarBndrUnit = TyVarBndr ()
type TyVarBndrSpec = TyVarBndr Specificity
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 :: Quote m => Lit -> m Pat
litP :: forall (m :: * -> *). Quote m => Lit -> m Pat
litP Lit
l = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Lit -> Pat
LitP Lit
l)
varP :: Quote m => Name -> m Pat
varP :: forall (m :: * -> *). Quote m => Name -> m Pat
varP Name
v = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Pat
VarP Name
v)
tupP :: Quote m => [m Pat] -> m Pat
tupP :: forall (m :: * -> *). Quote m => [m Pat] -> m Pat
tupP [m Pat]
ps = do { [Pat]
ps1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Pat] -> Pat
TupP [Pat]
ps1)}
unboxedTupP :: Quote m => [m Pat] -> m Pat
unboxedTupP :: forall (m :: * -> *). Quote m => [m Pat] -> m Pat
unboxedTupP [m Pat]
ps = do { [Pat]
ps1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Pat] -> Pat
UnboxedTupP [Pat]
ps1)}
unboxedSumP :: Quote m => m Pat -> SumAlt -> SumArity -> m Pat
unboxedSumP :: forall (m :: * -> *). Quote m => m Pat -> Int -> Int -> m Pat
unboxedSumP m Pat
p Int
alt Int
arity = do { Pat
p1 <- m Pat
p; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Int -> Int -> Pat
UnboxedSumP Pat
p1 Int
alt Int
arity) }
conP :: Quote m => Name -> [m Type] -> [m Pat] -> m Pat
conP :: forall (m :: * -> *).
Quote m =>
Name -> [m Type] -> [m Pat] -> m Pat
conP Name
n [m Type]
ts [m Pat]
ps = do [Pat]
ps' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps
[Type]
ts' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Type]
ts
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> [Type] -> [Pat] -> Pat
ConP Name
n [Type]
ts' [Pat]
ps')
infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
infixP :: forall (m :: * -> *). Quote m => m Pat -> Name -> m Pat -> m Pat
infixP m Pat
p1 Name
n m Pat
p2 = do Pat
p1' <- m Pat
p1
Pat
p2' <- m Pat
p2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Name -> Pat -> Pat
InfixP Pat
p1' Name
n Pat
p2')
uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
uInfixP :: forall (m :: * -> *). Quote m => m Pat -> Name -> m Pat -> m Pat
uInfixP m Pat
p1 Name
n m Pat
p2 = do Pat
p1' <- m Pat
p1
Pat
p2' <- m Pat
p2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Name -> Pat -> Pat
UInfixP Pat
p1' Name
n Pat
p2')
parensP :: Quote m => m Pat -> m Pat
parensP :: forall (m :: * -> *). Quote m => m Pat -> m Pat
parensP m Pat
p = do Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Pat
ParensP Pat
p')
tildeP :: Quote m => m Pat -> m Pat
tildeP :: forall (m :: * -> *). Quote m => m Pat -> m Pat
tildeP m Pat
p = do Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Pat
TildeP Pat
p')
bangP :: Quote m => m Pat -> m Pat
bangP :: forall (m :: * -> *). Quote m => m Pat -> m Pat
bangP m Pat
p = do Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Pat
BangP Pat
p')
asP :: Quote m => Name -> m Pat -> m Pat
asP :: forall (m :: * -> *). Quote m => Name -> m Pat -> m Pat
asP Name
n m Pat
p = do Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Pat -> Pat
AsP Name
n Pat
p')
wildP :: Quote m => m Pat
wildP :: forall (m :: * -> *). Quote m => m Pat
wildP = forall (f :: * -> *) a. Applicative f => a -> f a
pure Pat
WildP
recP :: Quote m => Name -> [m FieldPat] -> m Pat
recP :: forall (m :: * -> *). Quote m => Name -> [m FieldPat] -> m Pat
recP Name
n [m FieldPat]
fps = do [FieldPat]
fps' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m FieldPat]
fps
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> [FieldPat] -> Pat
RecP Name
n [FieldPat]
fps')
listP :: Quote m => [m Pat] -> m Pat
listP :: forall (m :: * -> *). Quote m => [m Pat] -> m Pat
listP [m Pat]
ps = do [Pat]
ps' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Pat] -> Pat
ListP [Pat]
ps')
sigP :: Quote m => m Pat -> m Type -> m Pat
sigP :: forall (m :: * -> *). Quote m => m Pat -> m Type -> m Pat
sigP m Pat
p m Type
t = do Pat
p' <- m Pat
p
Type
t' <- m Type
t
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Type -> Pat
SigP Pat
p' Type
t')
viewP :: Quote m => m Exp -> m Pat -> m Pat
viewP :: forall (m :: * -> *). Quote m => m Exp -> m Pat -> m Pat
viewP m Exp
e m Pat
p = do Exp
e' <- m Exp
e
Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Pat -> Pat
ViewP Exp
e' Pat
p')
fieldPat :: Quote m => Name -> m Pat -> m FieldPat
fieldPat :: forall (m :: * -> *). Quote m => Name -> m Pat -> m FieldPat
fieldPat Name
n m Pat
p = do Pat
p' <- m Pat
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name
n, Pat
p')
bindS :: Quote m => m Pat -> m Exp -> m Stmt
bindS :: forall (m :: * -> *). Quote m => m Pat -> m Exp -> m Stmt
bindS m Pat
p m Exp
e = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 Pat -> Exp -> Stmt
BindS m Pat
p m Exp
e
letS :: Quote m => [m Dec] -> m Stmt
letS :: forall (m :: * -> *). Quote m => [m Dec] -> m Stmt
letS [m Dec]
ds = do { [Dec]
ds1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
ds; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Dec] -> Stmt
LetS [Dec]
ds1) }
noBindS :: Quote m => m Exp -> m Stmt
noBindS :: forall (m :: * -> *). Quote m => m Exp -> m Stmt
noBindS m Exp
e = do { Exp
e1 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Stmt
NoBindS Exp
e1) }
parS :: Quote m => [[m Stmt]] -> m Stmt
parS :: forall (m :: * -> *). Quote m => [[m Stmt]] -> m Stmt
parS [[m Stmt]]
sss = do { [[Stmt]]
sss1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [[m Stmt]]
sss; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([[Stmt]] -> Stmt
ParS [[Stmt]]
sss1) }
recS :: Quote m => [m Stmt] -> m Stmt
recS :: forall (m :: * -> *). Quote m => [m Stmt] -> m Stmt
recS [m Stmt]
ss = do { [Stmt]
ss1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Stmt] -> Stmt
RecS [Stmt]
ss1) }
fromR :: Quote m => m Exp -> m Range
fromR :: forall (m :: * -> *). Quote m => m Exp -> m Range
fromR m Exp
x = do { Exp
a <- m Exp
x; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Range
FromR Exp
a) }
fromThenR :: Quote m => m Exp -> m Exp -> m Range
fromThenR :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Range
fromThenR m Exp
x m Exp
y = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Range
FromThenR Exp
a Exp
b) }
fromToR :: Quote m => m Exp -> m Exp -> m Range
fromToR :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Range
fromToR m Exp
x m Exp
y = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Range
FromToR Exp
a Exp
b) }
fromThenToR :: Quote m => m Exp -> m Exp -> m Exp -> m Range
fromThenToR :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp -> m Range
fromThenToR m Exp
x m Exp
y m Exp
z = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; Exp
c <- m Exp
z;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Exp -> Range
FromThenToR Exp
a Exp
b Exp
c) }
normalB :: Quote m => m Exp -> m Body
normalB :: forall (m :: * -> *). Quote m => m Exp -> m Body
normalB m Exp
e = do { Exp
e1 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Body
NormalB Exp
e1) }
guardedB :: Quote m => [m (Guard,Exp)] -> m Body
guardedB :: forall (m :: * -> *). Quote m => [m (Guard, Exp)] -> m Body
guardedB [m (Guard, Exp)]
ges = do { [(Guard, Exp)]
ges' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (Guard, Exp)]
ges; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Guard, Exp)] -> Body
GuardedB [(Guard, Exp)]
ges') }
normalG :: Quote m => m Exp -> m Guard
normalG :: forall (m :: * -> *). Quote m => m Exp -> m Guard
normalG m Exp
e = do { Exp
e1 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Guard
NormalG Exp
e1) }
normalGE :: Quote m => m Exp -> m Exp -> m (Guard, Exp)
normalGE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m (Guard, Exp)
normalGE m Exp
g m Exp
e = do { Exp
g1 <- m Exp
g; Exp
e1 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Guard
NormalG Exp
g1, Exp
e1) }
patG :: Quote m => [m Stmt] -> m Guard
patG :: forall (m :: * -> *). Quote m => [m Stmt] -> m Guard
patG [m Stmt]
ss = do { [Stmt]
ss' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Stmt] -> Guard
PatG [Stmt]
ss') }
patGE :: Quote m => [m Stmt] -> m Exp -> m (Guard, Exp)
patGE :: forall (m :: * -> *).
Quote m =>
[m Stmt] -> m Exp -> m (Guard, Exp)
patGE [m Stmt]
ss m Exp
e = do { [Stmt]
ss' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss;
Exp
e' <- m Exp
e;
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Stmt] -> Guard
PatG [Stmt]
ss', Exp
e') }
match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match
match :: forall (m :: * -> *).
Quote m =>
m Pat -> m Body -> [m Dec] -> m Match
match m Pat
p m Body
rhs [m Dec]
ds = do { Pat
p' <- m Pat
p;
Body
r' <- m Body
rhs;
[Dec]
ds' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
ds;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Body -> [Dec] -> Match
Match Pat
p' Body
r' [Dec]
ds') }
clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause
clause :: forall (m :: * -> *).
Quote m =>
[m Pat] -> m Body -> [m Dec] -> m Clause
clause [m Pat]
ps m Body
r [m Dec]
ds = do { [Pat]
ps' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps;
Body
r' <- m Body
r;
[Dec]
ds' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
ds;
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
ps' Body
r' [Dec]
ds') }
dyn :: Quote m => String -> m Exp
dyn :: forall (m :: * -> *). Quote m => String -> m Exp
dyn String
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Exp
VarE (String -> Name
mkName String
s))
varE :: Quote m => Name -> m Exp
varE :: forall (m :: * -> *). Quote m => Name -> m Exp
varE Name
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Exp
VarE Name
s)
conE :: Quote m => Name -> m Exp
conE :: forall (m :: * -> *). Quote m => Name -> m Exp
conE Name
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Exp
ConE Name
s)
litE :: Quote m => Lit -> m Exp
litE :: forall (m :: * -> *). Quote m => Lit -> m Exp
litE Lit
c = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Lit -> Exp
LitE Lit
c)
appE :: Quote m => m Exp -> m Exp -> m Exp
appE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
appE m Exp
x m Exp
y = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Exp
AppE Exp
a Exp
b)}
appTypeE :: Quote m => m Exp -> m Type -> m Exp
appTypeE :: forall (m :: * -> *). Quote m => m Exp -> m Type -> m Exp
appTypeE m Exp
x m Type
t = do { Exp
a <- m Exp
x; Type
s <- m Type
t; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Type -> Exp
AppTypeE Exp
a Type
s) }
parensE :: Quote m => m Exp -> m Exp
parensE :: forall (m :: * -> *). Quote m => m Exp -> m Exp
parensE m Exp
x = do { Exp
x' <- m Exp
x; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp
ParensE Exp
x') }
uInfixE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
uInfixE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp -> m Exp
uInfixE m Exp
x m Exp
s m Exp
y = do { Exp
x' <- m Exp
x; Exp
s' <- m Exp
s; Exp
y' <- m Exp
y;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Exp -> Exp
UInfixE Exp
x' Exp
s' Exp
y') }
infixE :: Quote m => Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixE :: forall (m :: * -> *).
Quote m =>
Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixE (Just m Exp
x) m Exp
s (Just m Exp
y) = do { Exp
a <- m Exp
x; Exp
s' <- m Exp
s; Exp
b <- m Exp
y;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE (forall a. a -> Maybe a
Just Exp
a) Exp
s' (forall a. a -> Maybe a
Just Exp
b))}
infixE Maybe (m Exp)
Nothing m Exp
s (Just m Exp
y) = do { Exp
s' <- m Exp
s; Exp
b <- m Exp
y;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE forall a. Maybe a
Nothing Exp
s' (forall a. a -> Maybe a
Just Exp
b))}
infixE (Just m Exp
x) m Exp
s Maybe (m Exp)
Nothing = do { Exp
a <- m Exp
x; Exp
s' <- m Exp
s;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE (forall a. a -> Maybe a
Just Exp
a) Exp
s' forall a. Maybe a
Nothing)}
infixE Maybe (m Exp)
Nothing m Exp
s Maybe (m Exp)
Nothing = do { Exp
s' <- m Exp
s; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE forall a. Maybe a
Nothing Exp
s' forall a. Maybe a
Nothing) }
infixApp :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
infixApp :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp -> m Exp
infixApp m Exp
x m Exp
y m Exp
z = forall (m :: * -> *).
Quote m =>
Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixE (forall a. a -> Maybe a
Just m Exp
x) m Exp
y (forall a. a -> Maybe a
Just m Exp
z)
sectionL :: Quote m => m Exp -> m Exp -> m Exp
sectionL :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
sectionL m Exp
x m Exp
y = forall (m :: * -> *).
Quote m =>
Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixE (forall a. a -> Maybe a
Just m Exp
x) m Exp
y forall a. Maybe a
Nothing
sectionR :: Quote m => m Exp -> m Exp -> m Exp
sectionR :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
sectionR m Exp
x m Exp
y = forall (m :: * -> *).
Quote m =>
Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixE forall a. Maybe a
Nothing m Exp
x (forall a. a -> Maybe a
Just m Exp
y)
lamE :: Quote m => [m Pat] -> m Exp -> m Exp
lamE :: forall (m :: * -> *). Quote m => [m Pat] -> m Exp -> m Exp
lamE [m Pat]
ps m Exp
e = do [Pat]
ps' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Pat]
ps
Exp
e' <- m Exp
e
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Pat] -> Exp -> Exp
LamE [Pat]
ps' Exp
e')
lam1E :: Quote m => m Pat -> m Exp -> m Exp
lam1E :: forall (m :: * -> *). Quote m => m Pat -> m Exp -> m Exp
lam1E m Pat
p m Exp
e = forall (m :: * -> *). Quote m => [m Pat] -> m Exp -> m Exp
lamE [m Pat
p] m Exp
e
lamCaseE :: Quote m => [m Match] -> m Exp
lamCaseE :: forall (m :: * -> *). Quote m => [m Match] -> m Exp
lamCaseE [m Match]
ms = [Match] -> Exp
LamCaseE forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Match]
ms
lamCasesE :: Quote m => [m Clause] -> m Exp
lamCasesE :: forall (m :: * -> *). Quote m => [m Clause] -> m Exp
lamCasesE [m Clause]
ms = [Clause] -> Exp
LamCasesE forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Clause]
ms
tupE :: Quote m => [Maybe (m Exp)] -> m Exp
tupE :: forall (m :: * -> *). Quote m => [Maybe (m Exp)] -> m Exp
tupE [Maybe (m Exp)]
es = do { [Maybe Exp]
es1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Maybe (m Exp)]
es; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Maybe Exp] -> Exp
TupE [Maybe Exp]
es1)}
unboxedTupE :: Quote m => [Maybe (m Exp)] -> m Exp
unboxedTupE :: forall (m :: * -> *). Quote m => [Maybe (m Exp)] -> m Exp
unboxedTupE [Maybe (m Exp)]
es = do { [Maybe Exp]
es1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Maybe (m Exp)]
es; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Maybe Exp] -> Exp
UnboxedTupE [Maybe Exp]
es1)}
unboxedSumE :: Quote m => m Exp -> SumAlt -> SumArity -> m Exp
unboxedSumE :: forall (m :: * -> *). Quote m => m Exp -> Int -> Int -> m Exp
unboxedSumE m Exp
e Int
alt Int
arity = do { Exp
e1 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Int -> Int -> Exp
UnboxedSumE Exp
e1 Int
alt Int
arity) }
condE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
condE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp -> m Exp
condE m Exp
x m Exp
y m Exp
z = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; Exp
c <- m Exp
z; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Exp -> Exp -> Exp
CondE Exp
a Exp
b Exp
c)}
multiIfE :: Quote m => [m (Guard, Exp)] -> m Exp
multiIfE :: forall (m :: * -> *). Quote m => [m (Guard, Exp)] -> m Exp
multiIfE [m (Guard, Exp)]
alts = [(Guard, Exp)] -> Exp
MultiIfE forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (Guard, Exp)]
alts
letE :: Quote m => [m Dec] -> m Exp -> m Exp
letE :: forall (m :: * -> *). Quote m => [m Dec] -> m Exp -> m Exp
letE [m Dec]
ds m Exp
e = do { [Dec]
ds2 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
ds; Exp
e2 <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Dec] -> Exp -> Exp
LetE [Dec]
ds2 Exp
e2) }
caseE :: Quote m => m Exp -> [m Match] -> m Exp
caseE :: forall (m :: * -> *). Quote m => m Exp -> [m Match] -> m Exp
caseE m Exp
e [m Match]
ms = do { Exp
e1 <- m Exp
e; [Match]
ms1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Match]
ms; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> [Match] -> Exp
CaseE Exp
e1 [Match]
ms1) }
doE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp
doE :: forall (m :: * -> *). Quote m => Maybe ModName -> [m Stmt] -> m Exp
doE Maybe ModName
m [m Stmt]
ss = do { [Stmt]
ss1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe ModName -> [Stmt] -> Exp
DoE Maybe ModName
m [Stmt]
ss1) }
mdoE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp
mdoE :: forall (m :: * -> *). Quote m => Maybe ModName -> [m Stmt] -> m Exp
mdoE Maybe ModName
m [m Stmt]
ss = do { [Stmt]
ss1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe ModName -> [Stmt] -> Exp
MDoE Maybe ModName
m [Stmt]
ss1) }
compE :: Quote m => [m Stmt] -> m Exp
compE :: forall (m :: * -> *). Quote m => [m Stmt] -> m Exp
compE [m Stmt]
ss = do { [Stmt]
ss1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Stmt]
ss; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Stmt] -> Exp
CompE [Stmt]
ss1) }
arithSeqE :: Quote m => m Range -> m Exp
arithSeqE :: forall (m :: * -> *). Quote m => m Range -> m Exp
arithSeqE m Range
r = do { Range
r' <- m Range
r; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range -> Exp
ArithSeqE Range
r') }
listE :: Quote m => [m Exp] -> m Exp
listE :: forall (m :: * -> *). Quote m => [m Exp] -> m Exp
listE [m Exp]
es = do { [Exp]
es1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Exp]
es; forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Exp] -> Exp
ListE [Exp]
es1) }
sigE :: Quote m => m Exp -> m Type -> m Exp
sigE :: forall (m :: * -> *). Quote m => m Exp -> m Type -> m Exp
sigE m Exp
e m Type
t = do { Exp
e1 <- m Exp
e; Type
t1 <- m Type
t; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> Type -> Exp
SigE Exp
e1 Type
t1) }
recConE :: Quote m => Name -> [m (Name,Exp)] -> m Exp
recConE :: forall (m :: * -> *). Quote m => Name -> [m (Name, Exp)] -> m Exp
recConE Name
c [m (Name, Exp)]
fs = do { [(Name, Exp)]
flds <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (Name, Exp)]
fs; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> [(Name, Exp)] -> Exp
RecConE Name
c [(Name, Exp)]
flds) }
recUpdE :: Quote m => m Exp -> [m (Name,Exp)] -> m Exp
recUpdE :: forall (m :: * -> *). Quote m => m Exp -> [m (Name, Exp)] -> m Exp
recUpdE m Exp
e [m (Name, Exp)]
fs = do { Exp
e1 <- m Exp
e; [(Name, Exp)]
flds <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (Name, Exp)]
fs; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> [(Name, Exp)] -> Exp
RecUpdE Exp
e1 [(Name, Exp)]
flds) }
stringE :: Quote m => String -> m Exp
stringE :: forall (m :: * -> *). Quote m => String -> m Exp
stringE = forall (m :: * -> *). Quote m => Lit -> m Exp
litE forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Lit
stringL
fieldExp :: Quote m => Name -> m Exp -> m (Name, Exp)
fieldExp :: forall (m :: * -> *). Quote m => Name -> m Exp -> m (Name, Exp)
fieldExp Name
s m Exp
e = do { Exp
e' <- m Exp
e; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name
s,Exp
e') }
staticE :: Quote m => m Exp -> m Exp
staticE :: forall (m :: * -> *). Quote m => m Exp -> m Exp
staticE = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Exp -> Exp
StaticE
unboundVarE :: Quote m => Name -> m Exp
unboundVarE :: forall (m :: * -> *). Quote m => Name -> m Exp
unboundVarE Name
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> Exp
UnboundVarE Name
s)
labelE :: Quote m => String -> m Exp
labelE :: forall (m :: * -> *). Quote m => String -> m Exp
labelE String
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (String -> Exp
LabelE String
s)
implicitParamVarE :: Quote m => String -> m Exp
implicitParamVarE :: forall (m :: * -> *). Quote m => String -> m Exp
implicitParamVarE String
n = forall (f :: * -> *) a. Applicative f => a -> f a
pure (String -> Exp
ImplicitParamVarE String
n)
getFieldE :: Quote m => m Exp -> String -> m Exp
getFieldE :: forall (m :: * -> *). Quote m => m Exp -> String -> m Exp
getFieldE m Exp
e String
f = do
Exp
e' <- m Exp
e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Exp -> String -> Exp
GetFieldE Exp
e' String
f)
projectionE :: Quote m => NonEmpty String -> m Exp
projectionE :: forall (m :: * -> *). Quote m => NonEmpty String -> m Exp
projectionE NonEmpty String
xs = forall (f :: * -> *) a. Applicative f => a -> f a
pure (NonEmpty String -> Exp
ProjectionE NonEmpty String
xs)
fromE :: Quote m => m Exp -> m Exp
fromE :: forall (m :: * -> *). Quote m => m Exp -> m Exp
fromE m Exp
x = do { Exp
a <- m Exp
x; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range -> Exp
ArithSeqE (Exp -> Range
FromR Exp
a)) }
fromThenE :: Quote m => m Exp -> m Exp -> m Exp
fromThenE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
fromThenE m Exp
x m Exp
y = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range -> Exp
ArithSeqE (Exp -> Exp -> Range
FromThenR Exp
a Exp
b)) }
fromToE :: Quote m => m Exp -> m Exp -> m Exp
fromToE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
fromToE m Exp
x m Exp
y = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range -> Exp
ArithSeqE (Exp -> Exp -> Range
FromToR Exp
a Exp
b)) }
fromThenToE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
fromThenToE :: forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp -> m Exp
fromThenToE m Exp
x m Exp
y m Exp
z = do { Exp
a <- m Exp
x; Exp
b <- m Exp
y; Exp
c <- m Exp
z;
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Range -> Exp
ArithSeqE (Exp -> Exp -> Exp -> Range
FromThenToR Exp
a Exp
b Exp
c)) }
valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec
valD :: forall (m :: * -> *).
Quote m =>
m Pat -> m Body -> [m Dec] -> m Dec
valD m Pat
p m Body
b [m Dec]
ds =
do { Pat
p' <- m Pat
p
; [Dec]
ds' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
ds
; Body
b' <- m Body
b
; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Pat -> Body -> [Dec] -> Dec
ValD Pat
p' Body
b' [Dec]
ds')
}
funD :: Quote m => Name -> [m Clause] -> m Dec
funD :: forall (m :: * -> *). Quote m => Name -> [m Clause] -> m Dec
funD Name
nm [m Clause]
cs =
do { [Clause]
cs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Clause]
cs
; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> [Clause] -> Dec
FunD Name
nm [Clause]
cs1)
}
tySynD :: Quote m => Name -> [m (TyVarBndr ())] -> m Type -> m Dec
tySynD :: forall (m :: * -> *).
Quote m =>
Name -> [m (TyVarBndr ())] -> m Type -> m Dec
tySynD Name
tc [m (TyVarBndr ())]
tvs m Type
rhs =
do { [TyVarBndr ()]
tvs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
; Type
rhs1 <- m Type
rhs
; forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> [TyVarBndr ()] -> Type -> Dec
TySynD Name
tc [TyVarBndr ()]
tvs1 Type
rhs1)
}
dataD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> [m Con]
-> [m DerivClause] -> m Dec
dataD :: forall (m :: * -> *).
Quote m =>
m [Type]
-> Name
-> [m (TyVarBndr ())]
-> Maybe (m Type)
-> [m Con]
-> [m DerivClause]
-> m Dec
dataD m [Type]
ctxt Name
tc [m (TyVarBndr ())]
tvs Maybe (m Type)
ksig [m Con]
cons [m DerivClause]
derivs =
do
[Type]
ctxt1 <- m [Type]
ctxt
[TyVarBndr ()]
tvs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
Maybe Type
ksig1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m Type)
ksig
[Con]
cons1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Con]
cons
[DerivClause]
derivs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m DerivClause]
derivs
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Type]
-> Name
-> [TyVarBndr ()]
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataD [Type]
ctxt1 Name
tc [TyVarBndr ()]
tvs1 Maybe Type
ksig1 [Con]
cons1 [DerivClause]
derivs1)
newtypeD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> m Con
-> [m DerivClause] -> m Dec
newtypeD :: forall (m :: * -> *).
Quote m =>
m [Type]
-> Name
-> [m (TyVarBndr ())]
-> Maybe (m Type)
-> m Con
-> [m DerivClause]
-> m Dec
newtypeD m [Type]
ctxt Name
tc [m (TyVarBndr ())]
tvs Maybe (m Type)
ksig m Con
con [m DerivClause]
derivs =
do
[Type]
ctxt1 <- m [Type]
ctxt
[TyVarBndr ()]
tvs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
Maybe Type
ksig1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m Type)
ksig
Con
con1 <- m Con
con
[DerivClause]
derivs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m DerivClause]
derivs
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Type]
-> Name
-> [TyVarBndr ()]
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeD [Type]
ctxt1 Name
tc [TyVarBndr ()]
tvs1 Maybe Type
ksig1 Con
con1 [DerivClause]
derivs1)
classD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> [FunDep] -> [m Dec] -> m Dec
classD :: forall (m :: * -> *).
Quote m =>
m [Type]
-> Name -> [m (TyVarBndr ())] -> [FunDep] -> [m Dec] -> m Dec
classD m [Type]
ctxt Name
cls [m (TyVarBndr ())]
tvs [FunDep]
fds [m Dec]
decs =
do
[TyVarBndr ()]
tvs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
[Dec]
decs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
decs
[Type]
ctxt1 <- m [Type]
ctxt
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ [Type] -> Name -> [TyVarBndr ()] -> [FunDep] -> [Dec] -> Dec
ClassD [Type]
ctxt1 Name
cls [TyVarBndr ()]
tvs1 [FunDep]
fds [Dec]
decs1
instanceD :: Quote m => m Cxt -> m Type -> [m Dec] -> m Dec
instanceD :: forall (m :: * -> *).
Quote m =>
m [Type] -> m Type -> [m Dec] -> m Dec
instanceD = forall (m :: * -> *).
Quote m =>
Maybe Overlap -> m [Type] -> m Type -> [m Dec] -> m Dec
instanceWithOverlapD forall a. Maybe a
Nothing
instanceWithOverlapD :: Quote m => Maybe Overlap -> m Cxt -> m Type -> [m Dec] -> m Dec
instanceWithOverlapD :: forall (m :: * -> *).
Quote m =>
Maybe Overlap -> m [Type] -> m Type -> [m Dec] -> m Dec
instanceWithOverlapD Maybe Overlap
o m [Type]
ctxt m Type
ty [m Dec]
decs =
do
[Type]
ctxt1 <- m [Type]
ctxt
[Dec]
decs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Dec]
decs
Type
ty1 <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Maybe Overlap -> [Type] -> Type -> [Dec] -> Dec
InstanceD Maybe Overlap
o [Type]
ctxt1 Type
ty1 [Dec]
decs1
sigD :: Quote m => Name -> m Type -> m Dec
sigD :: forall (m :: * -> *). Quote m => Name -> m Type -> m Dec
sigD Name
fun m Type
ty = forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b
liftA (Name -> Type -> Dec
SigD Name
fun) forall a b. (a -> b) -> a -> b
$ m Type
ty
kiSigD :: Quote m => Name -> m Kind -> m Dec
kiSigD :: forall (m :: * -> *). Quote m => Name -> m Type -> m Dec
kiSigD Name
fun m Type
ki = forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b
liftA (Name -> Type -> Dec
KiSigD Name
fun) forall a b. (a -> b) -> a -> b
$ m Type
ki
forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec
forImpD :: forall (m :: * -> *).
Quote m =>
Callconv -> Safety -> String -> Name -> m Type -> m Dec
forImpD Callconv
cc Safety
s String
str Name
n m Type
ty
= do Type
ty' <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure 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 :: Quote m => Int -> Name -> m Dec
infixLD :: forall (m :: * -> *). Quote m => Int -> Name -> m Dec
infixLD Int
prec Name
nm = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Fixity -> Name -> Dec
InfixD (Int -> FixityDirection -> Fixity
Fixity Int
prec FixityDirection
InfixL) Name
nm)
infixRD :: Quote m => Int -> Name -> m Dec
infixRD :: forall (m :: * -> *). Quote m => Int -> Name -> m Dec
infixRD Int
prec Name
nm = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Fixity -> Name -> Dec
InfixD (Int -> FixityDirection -> Fixity
Fixity Int
prec FixityDirection
InfixR) Name
nm)
infixND :: Quote m => Int -> Name -> m Dec
infixND :: forall (m :: * -> *). Quote m => Int -> Name -> m Dec
infixND Int
prec Name
nm = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Fixity -> Name -> Dec
InfixD (Int -> FixityDirection -> Fixity
Fixity Int
prec FixityDirection
InfixN) Name
nm)
defaultD :: Quote m => [m Type] -> m Dec
defaultD :: forall (m :: * -> *). Quote m => [m Type] -> m Dec
defaultD [m Type]
tys = [Type] -> Dec
DefaultD forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Type]
tys
pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec
pragInlD :: forall (m :: * -> *).
Quote m =>
Name -> Inline -> RuleMatch -> Phases -> m Dec
pragInlD Name
name Inline
inline RuleMatch
rm Phases
phases
= forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Name -> Inline -> RuleMatch -> Phases -> Pragma
InlineP Name
name Inline
inline RuleMatch
rm Phases
phases
pragOpaqueD :: Quote m => Name -> m Dec
pragOpaqueD :: forall (m :: * -> *). Quote m => Name -> m Dec
pragOpaqueD Name
name = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Name -> Pragma
OpaqueP Name
name
pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
pragSpecD :: forall (m :: * -> *). Quote m => Name -> m Type -> Phases -> m Dec
pragSpecD Name
n m Type
ty Phases
phases
= do
Type
ty1 <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseP Name
n Type
ty1 forall a. Maybe a
Nothing Phases
phases
pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec
pragSpecInlD :: forall (m :: * -> *).
Quote m =>
Name -> m Type -> Inline -> Phases -> m Dec
pragSpecInlD Name
n m Type
ty Inline
inline Phases
phases
= do
Type
ty1 <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseP Name
n Type
ty1 (forall a. a -> Maybe a
Just Inline
inline) Phases
phases
pragSpecInstD :: Quote m => m Type -> m Dec
pragSpecInstD :: forall (m :: * -> *). Quote m => m Type -> m Dec
pragSpecInstD m Type
ty
= do
Type
ty1 <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Type -> Pragma
SpecialiseInstP Type
ty1
pragRuleD :: Quote m => String -> Maybe [m (TyVarBndr ())] -> [m RuleBndr] -> m Exp -> m Exp
-> Phases -> m Dec
pragRuleD :: forall (m :: * -> *).
Quote m =>
String
-> Maybe [m (TyVarBndr ())]
-> [m RuleBndr]
-> m Exp
-> m Exp
-> Phases
-> m Dec
pragRuleD String
n Maybe [m (TyVarBndr ())]
ty_bndrs [m RuleBndr]
tm_bndrs m Exp
lhs m Exp
rhs Phases
phases
= do
Maybe [TyVarBndr ()]
ty_bndrs1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe [m (TyVarBndr ())]
ty_bndrs
[RuleBndr]
tm_bndrs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m RuleBndr]
tm_bndrs
Exp
lhs1 <- m Exp
lhs
Exp
rhs1 <- m Exp
rhs
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD 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 :: Quote m => AnnTarget -> m Exp -> m Dec
pragAnnD :: forall (m :: * -> *). Quote m => AnnTarget -> m Exp -> m Dec
pragAnnD AnnTarget
target m Exp
expr
= do
Exp
exp1 <- m Exp
expr
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ AnnTarget -> Exp -> Pragma
AnnP AnnTarget
target Exp
exp1
pragLineD :: Quote m => Int -> String -> m Dec
pragLineD :: forall (m :: * -> *). Quote m => Int -> String -> m Dec
pragLineD Int
line String
file = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ Int -> String -> Pragma
LineP Int
line String
file
pragCompleteD :: Quote m => [Name] -> Maybe Name -> m Dec
pragCompleteD :: forall (m :: * -> *). Quote m => [Name] -> Maybe Name -> m Dec
pragCompleteD [Name]
cls Maybe Name
mty = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Pragma -> Dec
PragmaD forall a b. (a -> b) -> a -> b
$ [Name] -> Maybe Name -> Pragma
CompleteP [Name]
cls Maybe Name
mty
dataInstD :: Quote m => m Cxt -> (Maybe [m (TyVarBndr ())]) -> m Type -> Maybe (m Kind) -> [m Con]
-> [m DerivClause] -> m Dec
dataInstD :: forall (m :: * -> *).
Quote m =>
m [Type]
-> Maybe [m (TyVarBndr ())]
-> m Type
-> Maybe (m Type)
-> [m Con]
-> [m DerivClause]
-> m Dec
dataInstD m [Type]
ctxt Maybe [m (TyVarBndr ())]
mb_bndrs m Type
ty Maybe (m Type)
ksig [m Con]
cons [m DerivClause]
derivs =
do
[Type]
ctxt1 <- m [Type]
ctxt
Maybe [TyVarBndr ()]
mb_bndrs1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe [m (TyVarBndr ())]
mb_bndrs
Type
ty1 <- m Type
ty
Maybe Type
ksig1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m Type)
ksig
[Con]
cons1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Con]
cons
[DerivClause]
derivs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m DerivClause]
derivs
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Type]
-> Maybe [TyVarBndr ()]
-> Type
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataInstD [Type]
ctxt1 Maybe [TyVarBndr ()]
mb_bndrs1 Type
ty1 Maybe Type
ksig1 [Con]
cons1 [DerivClause]
derivs1)
newtypeInstD :: Quote m => m Cxt -> (Maybe [m (TyVarBndr ())]) -> m Type -> Maybe (m Kind) -> m Con
-> [m DerivClause] -> m Dec
newtypeInstD :: forall (m :: * -> *).
Quote m =>
m [Type]
-> Maybe [m (TyVarBndr ())]
-> m Type
-> Maybe (m Type)
-> m Con
-> [m DerivClause]
-> m Dec
newtypeInstD m [Type]
ctxt Maybe [m (TyVarBndr ())]
mb_bndrs m Type
ty Maybe (m Type)
ksig m Con
con [m DerivClause]
derivs =
do
[Type]
ctxt1 <- m [Type]
ctxt
Maybe [TyVarBndr ()]
mb_bndrs1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe [m (TyVarBndr ())]
mb_bndrs
Type
ty1 <- m Type
ty
Maybe Type
ksig1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m Type)
ksig
Con
con1 <- m Con
con
[DerivClause]
derivs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m DerivClause]
derivs
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Type]
-> Maybe [TyVarBndr ()]
-> Type
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeInstD [Type]
ctxt1 Maybe [TyVarBndr ()]
mb_bndrs1 Type
ty1 Maybe Type
ksig1 Con
con1 [DerivClause]
derivs1)
tySynInstD :: Quote m => m TySynEqn -> m Dec
tySynInstD :: forall (m :: * -> *). Quote m => m TySynEqn -> m Dec
tySynInstD m TySynEqn
eqn =
do
TySynEqn
eqn1 <- m TySynEqn
eqn
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TySynEqn -> Dec
TySynInstD TySynEqn
eqn1)
dataFamilyD :: Quote m => Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> m Dec
dataFamilyD :: forall (m :: * -> *).
Quote m =>
Name -> [m (TyVarBndr ())] -> Maybe (m Type) -> m Dec
dataFamilyD Name
tc [m (TyVarBndr ())]
tvs Maybe (m Type)
kind =
do [TyVarBndr ()]
tvs' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
Maybe Type
kind' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m Type)
kind
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Name -> [TyVarBndr ()] -> Maybe Type -> Dec
DataFamilyD Name
tc [TyVarBndr ()]
tvs' Maybe Type
kind'
openTypeFamilyD :: Quote m => Name -> [m (TyVarBndr ())] -> m FamilyResultSig
-> Maybe InjectivityAnn -> m Dec
openTypeFamilyD :: forall (m :: * -> *).
Quote m =>
Name
-> [m (TyVarBndr ())]
-> m FamilyResultSig
-> Maybe InjectivityAnn
-> m Dec
openTypeFamilyD Name
tc [m (TyVarBndr ())]
tvs m FamilyResultSig
res Maybe InjectivityAnn
inj =
do [TyVarBndr ()]
tvs' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
FamilyResultSig
res' <- m FamilyResultSig
res
forall (f :: * -> *) a. Applicative f => a -> f a
pure 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 :: Quote m => Name -> [m (TyVarBndr ())] -> m FamilyResultSig
-> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec
closedTypeFamilyD :: forall (m :: * -> *).
Quote m =>
Name
-> [m (TyVarBndr ())]
-> m FamilyResultSig
-> Maybe InjectivityAnn
-> [m TySynEqn]
-> m Dec
closedTypeFamilyD Name
tc [m (TyVarBndr ())]
tvs m FamilyResultSig
result Maybe InjectivityAnn
injectivity [m TySynEqn]
eqns =
do [TyVarBndr ()]
tvs1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvs
FamilyResultSig
result1 <- m FamilyResultSig
result
[TySynEqn]
eqns1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m TySynEqn]
eqns
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TypeFamilyHead -> [TySynEqn] -> Dec
ClosedTypeFamilyD (Name
-> [TyVarBndr ()]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
tc [TyVarBndr ()]
tvs1 FamilyResultSig
result1 Maybe InjectivityAnn
injectivity) [TySynEqn]
eqns1)
roleAnnotD :: Quote m => Name -> [Role] -> m Dec
roleAnnotD :: forall (m :: * -> *). Quote m => Name -> [Role] -> m Dec
roleAnnotD Name
name [Role]
roles = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Name -> [Role] -> Dec
RoleAnnotD Name
name [Role]
roles
standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec
standaloneDerivD :: forall (m :: * -> *). Quote m => m [Type] -> m Type -> m Dec
standaloneDerivD = forall (m :: * -> *).
Quote m =>
Maybe (m DerivStrategy) -> m [Type] -> m Type -> m Dec
standaloneDerivWithStrategyD forall a. Maybe a
Nothing
standaloneDerivWithStrategyD :: Quote m => Maybe (m DerivStrategy) -> m Cxt -> m Type -> m Dec
standaloneDerivWithStrategyD :: forall (m :: * -> *).
Quote m =>
Maybe (m DerivStrategy) -> m [Type] -> m Type -> m Dec
standaloneDerivWithStrategyD Maybe (m DerivStrategy)
mdsq m [Type]
ctxtq m Type
tyq =
do
Maybe DerivStrategy
mds <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m DerivStrategy)
mdsq
[Type]
ctxt <- m [Type]
ctxtq
Type
ty <- m Type
tyq
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Maybe DerivStrategy -> [Type] -> Type -> Dec
StandaloneDerivD Maybe DerivStrategy
mds [Type]
ctxt Type
ty
defaultSigD :: Quote m => Name -> m Type -> m Dec
defaultSigD :: forall (m :: * -> *). Quote m => Name -> m Type -> m Dec
defaultSigD Name
n m Type
tyq =
do
Type
ty <- m Type
tyq
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Name -> Type -> Dec
DefaultSigD Name
n Type
ty
patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
patSynD :: forall (m :: * -> *).
Quote m =>
Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
patSynD Name
name m PatSynArgs
args m PatSynDir
dir m Pat
pat = do
PatSynArgs
args' <- m PatSynArgs
args
PatSynDir
dir' <- m PatSynDir
dir
Pat
pat' <- m Pat
pat
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Name -> PatSynArgs -> PatSynDir -> Pat -> Dec
PatSynD Name
name PatSynArgs
args' PatSynDir
dir' Pat
pat')
patSynSigD :: Quote m => Name -> m Type -> m Dec
patSynSigD :: forall (m :: * -> *). Quote m => Name -> m Type -> m Dec
patSynSigD Name
nm m Type
ty =
do Type
ty' <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Name -> Type -> Dec
PatSynSigD Name
nm Type
ty'
implicitParamBindD :: Quote m => String -> m Exp -> m Dec
implicitParamBindD :: forall (m :: * -> *). Quote m => String -> m Exp -> m Dec
implicitParamBindD String
n m Exp
e =
do
Exp
e' <- m Exp
e
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ String -> Exp -> Dec
ImplicitParamBindD String
n Exp
e'
tySynEqn :: Quote m => (Maybe [m (TyVarBndr ())]) -> m Type -> m Type -> m TySynEqn
tySynEqn :: forall (m :: * -> *).
Quote m =>
Maybe [m (TyVarBndr ())] -> m Type -> m Type -> m TySynEqn
tySynEqn Maybe [m (TyVarBndr ())]
mb_bndrs m Type
lhs m Type
rhs =
do
Maybe [TyVarBndr ()]
mb_bndrs1 <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe [m (TyVarBndr ())]
mb_bndrs
Type
lhs1 <- m Type
lhs
Type
rhs1 <- m Type
rhs
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr ()]
mb_bndrs1 Type
lhs1 Type
rhs1)
cxt :: Quote m => [m Pred] -> m Cxt
cxt :: forall (m :: * -> *). Quote m => [m Type] -> m [Type]
cxt = forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA
derivClause :: Quote m => Maybe (m DerivStrategy) -> [m Pred] -> m DerivClause
derivClause :: forall (m :: * -> *).
Quote m =>
Maybe (m DerivStrategy) -> [m Type] -> m DerivClause
derivClause Maybe (m DerivStrategy)
mds [m Type]
p = do Maybe DerivStrategy
mds' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA Maybe (m DerivStrategy)
mds
[Type]
p' <- forall (m :: * -> *). Quote m => [m Type] -> m [Type]
cxt [m Type]
p
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Maybe DerivStrategy -> [Type] -> DerivClause
DerivClause Maybe DerivStrategy
mds' [Type]
p'
stockStrategy :: Quote m => m DerivStrategy
stockStrategy :: forall (m :: * -> *). Quote m => m DerivStrategy
stockStrategy = forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
StockStrategy
anyclassStrategy :: Quote m => m DerivStrategy
anyclassStrategy :: forall (m :: * -> *). Quote m => m DerivStrategy
anyclassStrategy = forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
AnyclassStrategy
newtypeStrategy :: Quote m => m DerivStrategy
newtypeStrategy :: forall (m :: * -> *). Quote m => m DerivStrategy
newtypeStrategy = forall (f :: * -> *) a. Applicative f => a -> f a
pure DerivStrategy
NewtypeStrategy
viaStrategy :: Quote m => m Type -> m DerivStrategy
viaStrategy :: forall (m :: * -> *). Quote m => m Type -> m DerivStrategy
viaStrategy = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Type -> DerivStrategy
ViaStrategy
normalC :: Quote m => Name -> [m BangType] -> m Con
normalC :: forall (m :: * -> *). Quote m => Name -> [m BangType] -> m Con
normalC Name
con [m BangType]
strtys = forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b
liftA (Name -> [BangType] -> Con
NormalC Name
con) forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m BangType]
strtys
recC :: Quote m => Name -> [m VarBangType] -> m Con
recC :: forall (m :: * -> *). Quote m => Name -> [m VarBangType] -> m Con
recC Name
con [m VarBangType]
varstrtys = forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b
liftA (Name -> [VarBangType] -> Con
RecC Name
con) forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m VarBangType]
varstrtys
infixC :: Quote m => m (Bang, Type) -> Name -> m (Bang, Type) -> m Con
infixC :: forall (m :: * -> *).
Quote m =>
m BangType -> Name -> m BangType -> m Con
infixC m BangType
st1 Name
con m BangType
st2 = do BangType
st1' <- m BangType
st1
BangType
st2' <- m BangType
st2
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ BangType -> Name -> BangType -> Con
InfixC BangType
st1' Name
con BangType
st2'
forallC :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Con -> m Con
forallC :: forall (m :: * -> *).
Quote m =>
[m (TyVarBndr Specificity)] -> m [Type] -> m Con -> m Con
forallC [m (TyVarBndr Specificity)]
ns m [Type]
ctxt m Con
con = do
[TyVarBndr Specificity]
ns' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr Specificity)]
ns
[Type]
ctxt' <- m [Type]
ctxt
Con
con' <- m Con
con
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ [TyVarBndr Specificity] -> [Type] -> Con -> Con
ForallC [TyVarBndr Specificity]
ns' [Type]
ctxt' Con
con'
gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con
gadtC :: forall (m :: * -> *).
Quote m =>
[Name] -> [m BangType] -> m Type -> m Con
gadtC [Name]
cons [m BangType]
strtys m Type
ty = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 ([Name] -> [BangType] -> Type -> Con
GadtC [Name]
cons) (forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m BangType]
strtys) m Type
ty
recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con
recGadtC :: forall (m :: * -> *).
Quote m =>
[Name] -> [m VarBangType] -> m Type -> m Con
recGadtC [Name]
cons [m VarBangType]
varstrtys m Type
ty = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 ([Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
cons) (forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m VarBangType]
varstrtys) m Type
ty
forallT :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Type -> m Type
forallT :: forall (m :: * -> *).
Quote m =>
[m (TyVarBndr Specificity)] -> m [Type] -> m Type -> m Type
forallT [m (TyVarBndr Specificity)]
tvars m [Type]
ctxt m Type
ty = do
[TyVarBndr Specificity]
tvars1 <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr Specificity)]
tvars
[Type]
ctxt1 <- m [Type]
ctxt
Type
ty1 <- m Type
ty
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ [TyVarBndr Specificity] -> [Type] -> Type -> Type
ForallT [TyVarBndr Specificity]
tvars1 [Type]
ctxt1 Type
ty1
forallVisT :: Quote m => [m (TyVarBndr ())] -> m Type -> m Type
forallVisT :: forall (m :: * -> *).
Quote m =>
[m (TyVarBndr ())] -> m Type -> m Type
forallVisT [m (TyVarBndr ())]
tvars m Type
ty = [TyVarBndr ()] -> Type -> Type
ForallVisT forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m (TyVarBndr ())]
tvars forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Type
ty
varT :: Quote m => Name -> m Type
varT :: forall (m :: * -> *). Quote m => Name -> m Type
varT = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
VarT
conT :: Quote m => Name -> m Type
conT :: forall (m :: * -> *). Quote m => Name -> m Type
conT = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
ConT
infixT :: Quote m => m Type -> Name -> m Type -> m Type
infixT :: forall (m :: * -> *). Quote m => m Type -> Name -> m Type -> m Type
infixT m Type
t1 Name
n m Type
t2 = do Type
t1' <- m Type
t1
Type
t2' <- m Type
t2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Type -> Name -> Type -> Type
InfixT Type
t1' Name
n Type
t2')
uInfixT :: Quote m => m Type -> Name -> m Type -> m Type
uInfixT :: forall (m :: * -> *). Quote m => m Type -> Name -> m Type -> m Type
uInfixT m Type
t1 Name
n m Type
t2 = do Type
t1' <- m Type
t1
Type
t2' <- m Type
t2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Type -> Name -> Type -> Type
UInfixT Type
t1' Name
n Type
t2')
promotedInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedInfixT :: forall (m :: * -> *). Quote m => m Type -> Name -> m Type -> m Type
promotedInfixT m Type
t1 Name
n m Type
t2 = do Type
t1' <- m Type
t1
Type
t2' <- m Type
t2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Type -> Name -> Type -> Type
PromotedInfixT Type
t1' Name
n Type
t2')
promotedUInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedUInfixT :: forall (m :: * -> *). Quote m => m Type -> Name -> m Type -> m Type
promotedUInfixT m Type
t1 Name
n m Type
t2 = do Type
t1' <- m Type
t1
Type
t2' <- m Type
t2
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Type -> Name -> Type -> Type
PromotedUInfixT Type
t1' Name
n Type
t2')
parensT :: Quote m => m Type -> m Type
parensT :: forall (m :: * -> *). Quote m => m Type -> m Type
parensT m Type
t = do Type
t' <- m Type
t
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Type -> Type
ParensT Type
t')
appT :: Quote m => m Type -> m Type -> m Type
appT :: forall (m :: * -> *). Quote m => m Type -> m Type -> m Type
appT m Type
t1 m Type
t2 = do
Type
t1' <- m Type
t1
Type
t2' <- m Type
t2
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
AppT Type
t1' Type
t2'
appKindT :: Quote m => m Type -> m Kind -> m Type
appKindT :: forall (m :: * -> *). Quote m => m Type -> m Type -> m Type
appKindT m Type
ty m Type
ki = do
Type
ty' <- m Type
ty
Type
ki' <- m Type
ki
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
AppKindT Type
ty' Type
ki'
arrowT :: Quote m => m Type
arrowT :: forall (m :: * -> *). Quote m => m Type
arrowT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
ArrowT
mulArrowT :: Quote m => m Type
mulArrowT :: forall (m :: * -> *). Quote m => m Type
mulArrowT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
MulArrowT
listT :: Quote m => m Type
listT :: forall (m :: * -> *). Quote m => m Type
listT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
ListT
litT :: Quote m => m TyLit -> m Type
litT :: forall (m :: * -> *). Quote m => m TyLit -> m Type
litT m TyLit
l = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TyLit -> Type
LitT m TyLit
l
tupleT :: Quote m => Int -> m Type
tupleT :: forall (m :: * -> *). Quote m => Int -> m Type
tupleT Int
i = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> Type
TupleT Int
i)
unboxedTupleT :: Quote m => Int -> m Type
unboxedTupleT :: forall (m :: * -> *). Quote m => Int -> m Type
unboxedTupleT Int
i = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> Type
UnboxedTupleT Int
i)
unboxedSumT :: Quote m => SumArity -> m Type
unboxedSumT :: forall (m :: * -> *). Quote m => Int -> m Type
unboxedSumT Int
arity = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> Type
UnboxedSumT Int
arity)
sigT :: Quote m => m Type -> m Kind -> m Type
sigT :: forall (m :: * -> *). Quote m => m Type -> m Type -> m Type
sigT m Type
t m Type
k
= do
Type
t' <- m Type
t
Type
k' <- m Type
k
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Type -> Type -> Type
SigT Type
t' Type
k'
equalityT :: Quote m => m Type
equalityT :: forall (m :: * -> *). Quote m => m Type
equalityT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
EqualityT
wildCardT :: Quote m => m Type
wildCardT :: forall (m :: * -> *). Quote m => m Type
wildCardT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
WildCardT
implicitParamT :: Quote m => String -> m Type -> m Type
implicitParamT :: forall (m :: * -> *). Quote m => String -> m Type -> m Type
implicitParamT String
n m Type
t
= do
Type
t' <- m Type
t
forall (f :: * -> *) a. Applicative f => a -> f a
pure 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 :: Quote m => Name -> [m Type] -> m Pred
classP :: forall (m :: * -> *). Quote m => Name -> [m Type] -> m Type
classP Name
cla [m Type]
tys
= do
[Type]
tysl <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Type]
tys
forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Type -> Type -> Type
AppT (Name -> Type
ConT Name
cla) [Type]
tysl)
{-# DEPRECATED equalP "As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please see 'equalityT'." #-}
equalP :: Quote m => m Type -> m Type -> m Pred
equalP :: forall (m :: * -> *). Quote m => m Type -> m Type -> m Type
equalP m Type
tleft m Type
tright
= do
Type
tleft1 <- m Type
tleft
Type
tright1 <- m Type
tright
Type
eqT <- forall (m :: * -> *). Quote m => m Type
equalityT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (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 :: Quote m => Name -> m Type
promotedT :: forall (m :: * -> *). Quote m => Name -> m Type
promotedT = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Type
PromotedT
promotedTupleT :: Quote m => Int -> m Type
promotedTupleT :: forall (m :: * -> *). Quote m => Int -> m Type
promotedTupleT Int
i = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> Type
PromotedTupleT Int
i)
promotedNilT :: Quote m => m Type
promotedNilT :: forall (m :: * -> *). Quote m => m Type
promotedNilT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
PromotedNilT
promotedConsT :: Quote m => m Type
promotedConsT :: forall (m :: * -> *). Quote m => m Type
promotedConsT = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
PromotedConsT
noSourceUnpackedness, sourceNoUnpack, sourceUnpack :: Quote m => m SourceUnpackedness
noSourceUnpackedness :: forall (m :: * -> *). Quote m => m SourceUnpackedness
noSourceUnpackedness = forall (f :: * -> *) a. Applicative f => a -> f a
pure SourceUnpackedness
NoSourceUnpackedness
sourceNoUnpack :: forall (m :: * -> *). Quote m => m SourceUnpackedness
sourceNoUnpack = forall (f :: * -> *) a. Applicative f => a -> f a
pure SourceUnpackedness
SourceNoUnpack
sourceUnpack :: forall (m :: * -> *). Quote m => m SourceUnpackedness
sourceUnpack = forall (f :: * -> *) a. Applicative f => a -> f a
pure SourceUnpackedness
SourceUnpack
noSourceStrictness, sourceLazy, sourceStrict :: Quote m => m SourceStrictness
noSourceStrictness :: forall (m :: * -> *). Quote m => m SourceStrictness
noSourceStrictness = forall (f :: * -> *) a. Applicative f => a -> f a
pure SourceStrictness
NoSourceStrictness
sourceLazy :: forall (m :: * -> *). Quote m => m SourceStrictness
sourceLazy = forall (f :: * -> *) a. Applicative f => a -> f a
pure SourceStrictness
SourceLazy
sourceStrict :: forall (m :: * -> *). Quote m => m SourceStrictness
sourceStrict = forall (f :: * -> *) a. Applicative f => a -> f a
pure 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 :: Quote m => m Strict
isStrict :: forall (m :: * -> *). Quote m => m Strict
isStrict = forall (m :: * -> *).
Quote m =>
m SourceUnpackedness -> m SourceStrictness -> m Strict
bang forall (m :: * -> *). Quote m => m SourceUnpackedness
noSourceUnpackedness forall (m :: * -> *). Quote m => m SourceStrictness
sourceStrict
notStrict :: forall (m :: * -> *). Quote m => m Strict
notStrict = forall (m :: * -> *).
Quote m =>
m SourceUnpackedness -> m SourceStrictness -> m Strict
bang forall (m :: * -> *). Quote m => m SourceUnpackedness
noSourceUnpackedness forall (m :: * -> *). Quote m => m SourceStrictness
noSourceStrictness
unpacked :: forall (m :: * -> *). Quote m => m Strict
unpacked = forall (m :: * -> *).
Quote m =>
m SourceUnpackedness -> m SourceStrictness -> m Strict
bang forall (m :: * -> *). Quote m => m SourceUnpackedness
sourceUnpack forall (m :: * -> *). Quote m => m SourceStrictness
sourceStrict
bang :: Quote m => m SourceUnpackedness -> m SourceStrictness -> m Bang
bang :: forall (m :: * -> *).
Quote m =>
m SourceUnpackedness -> m SourceStrictness -> m Strict
bang m SourceUnpackedness
u m SourceStrictness
s = do SourceUnpackedness
u' <- m SourceUnpackedness
u
SourceStrictness
s' <- m SourceStrictness
s
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SourceUnpackedness -> SourceStrictness -> Strict
Bang SourceUnpackedness
u' SourceStrictness
s')
bangType :: Quote m => m Bang -> m Type -> m BangType
bangType :: forall (m :: * -> *). Quote m => m Strict -> m Type -> m BangType
bangType = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (,)
varBangType :: Quote m => Name -> m BangType -> m VarBangType
varBangType :: forall (m :: * -> *).
Quote m =>
Name -> m BangType -> m VarBangType
varBangType Name
v m BangType
bt = (\(Strict
b, Type
t) -> (Name
v, Strict
b, Type
t)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m BangType
bt
{-# DEPRECATED strictType
"As of @template-haskell-2.11.0.0@, 'StrictType' has been replaced by 'BangType'. Please use 'bangType' instead." #-}
strictType :: Quote m => m Strict -> m Type -> m StrictType
strictType :: forall (m :: * -> *). Quote m => m Strict -> m Type -> m BangType
strictType = forall (m :: * -> *). Quote m => m Strict -> m Type -> m BangType
bangType
{-# DEPRECATED varStrictType
"As of @template-haskell-2.11.0.0@, 'VarStrictType' has been replaced by 'VarBangType'. Please use 'varBangType' instead." #-}
varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType
varStrictType :: forall (m :: * -> *).
Quote m =>
Name -> m BangType -> m VarBangType
varStrictType = forall (m :: * -> *).
Quote m =>
Name -> m BangType -> m VarBangType
varBangType
numTyLit :: Quote m => Integer -> m TyLit
numTyLit :: forall (m :: * -> *). Quote m => Integer -> m TyLit
numTyLit Integer
n = if Integer
n forall a. Ord a => a -> a -> Bool
>= Integer
0 then forall (f :: * -> *) a. Applicative f => a -> f a
pure (Integer -> TyLit
NumTyLit Integer
n)
else forall a. HasCallStack => String -> a
error (String
"Negative type-level number: " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Integer
n)
strTyLit :: Quote m => String -> m TyLit
strTyLit :: forall (m :: * -> *). Quote m => String -> m TyLit
strTyLit String
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure (String -> TyLit
StrTyLit String
s)
charTyLit :: Quote m => Char -> m TyLit
charTyLit :: forall (m :: * -> *). Quote m => Char -> m TyLit
charTyLit Char
c = forall (f :: * -> *) a. Applicative f => a -> f a
pure (Char -> TyLit
CharTyLit Char
c)
plainTV :: Quote m => Name -> m (TyVarBndr ())
plainTV :: forall (m :: * -> *). Quote m => Name -> m (TyVarBndr ())
plainTV Name
n = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall flag. Name -> flag -> TyVarBndr flag
PlainTV Name
n ()
plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity)
plainInvisTV :: forall (m :: * -> *).
Quote m =>
Name -> Specificity -> m (TyVarBndr Specificity)
plainInvisTV Name
n Specificity
s = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall flag. Name -> flag -> TyVarBndr flag
PlainTV Name
n Specificity
s
kindedTV :: Quote m => Name -> m Kind -> m (TyVarBndr ())
kindedTV :: forall (m :: * -> *). Quote m => Name -> m Type -> m (TyVarBndr ())
kindedTV Name
n = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall flag. Name -> flag -> Type -> TyVarBndr flag
KindedTV Name
n ())
kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity)
kindedInvisTV :: forall (m :: * -> *).
Quote m =>
Name -> Specificity -> m Type -> m (TyVarBndr Specificity)
kindedInvisTV Name
n Specificity
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall flag. Name -> flag -> Type -> TyVarBndr flag
KindedTV Name
n Specificity
s)
specifiedSpec :: Specificity
specifiedSpec :: Specificity
specifiedSpec = Specificity
SpecifiedSpec
inferredSpec :: Specificity
inferredSpec :: Specificity
inferredSpec = Specificity
InferredSpec
varK :: Name -> Kind
varK :: Name -> Type
varK = Name -> Type
VarT
conK :: Name -> Kind
conK :: Name -> Type
conK = Name -> Type
ConT
tupleK :: Int -> Kind
tupleK :: Int -> Type
tupleK = Int -> 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 :: Quote m => m Kind
starK :: forall (m :: * -> *). Quote m => m Type
starK = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
StarT
constraintK :: Quote m => m Kind
constraintK :: forall (m :: * -> *). Quote m => m Type
constraintK = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
ConstraintT
noSig :: Quote m => m FamilyResultSig
noSig :: forall (m :: * -> *). Quote m => m FamilyResultSig
noSig = forall (f :: * -> *) a. Applicative f => a -> f a
pure FamilyResultSig
NoSig
kindSig :: Quote m => m Kind -> m FamilyResultSig
kindSig :: forall (m :: * -> *). Quote m => m Type -> m FamilyResultSig
kindSig = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Type -> FamilyResultSig
KindSig
tyVarSig :: Quote m => m (TyVarBndr ()) -> m FamilyResultSig
tyVarSig :: forall (m :: * -> *).
Quote m =>
m (TyVarBndr ()) -> m FamilyResultSig
tyVarSig = 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 :: Quote m => Name -> m RuleBndr
ruleVar :: forall (m :: * -> *). Quote m => Name -> m RuleBndr
ruleVar = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> RuleBndr
RuleVar
typedRuleVar :: Quote m => Name -> m Type -> m RuleBndr
typedRuleVar :: forall (m :: * -> *). Quote m => Name -> m Type -> m RuleBndr
typedRuleVar Name
n m Type
ty = Name -> Type -> RuleBndr
TypedRuleVar Name
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Type
ty
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 :: Quote m => m PatSynDir
unidir :: forall (m :: * -> *). Quote m => m PatSynDir
unidir = forall (f :: * -> *) a. Applicative f => a -> f a
pure PatSynDir
Unidir
implBidir :: forall (m :: * -> *). Quote m => m PatSynDir
implBidir = forall (f :: * -> *) a. Applicative f => a -> f a
pure PatSynDir
ImplBidir
explBidir :: Quote m => [m Clause] -> m PatSynDir
explBidir :: forall (m :: * -> *). Quote m => [m Clause] -> m PatSynDir
explBidir [m Clause]
cls = do
[Clause]
cls' <- forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [m Clause]
cls
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Clause] -> PatSynDir
ExplBidir [Clause]
cls')
prefixPatSyn :: Quote m => [Name] -> m PatSynArgs
prefixPatSyn :: forall (m :: * -> *). Quote m => [Name] -> m PatSynArgs
prefixPatSyn [Name]
args = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ [Name] -> PatSynArgs
PrefixPatSyn [Name]
args
recordPatSyn :: Quote m => [Name] -> m PatSynArgs
recordPatSyn :: forall (m :: * -> *). Quote m => [Name] -> m PatSynArgs
recordPatSyn [Name]
sels = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ [Name] -> PatSynArgs
RecordPatSyn [Name]
sels
infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs
infixPatSyn :: forall (m :: * -> *). Quote m => Name -> Name -> m PatSynArgs
infixPatSyn Name
arg1 Name
arg2 = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Name -> Name -> PatSynArgs
InfixPatSyn Name
arg1 Name
arg2
appsE :: Quote m => [m Exp] -> m Exp
appsE :: forall (m :: * -> *). Quote m => [m Exp] -> m Exp
appsE [] = forall a. HasCallStack => String -> a
error String
"appsE []"
appsE [m Exp
x] = m Exp
x
appsE (m Exp
x:m Exp
y:[m Exp]
zs) = forall (m :: * -> *). Quote m => [m Exp] -> m Exp
appsE ( (forall (m :: * -> *). Quote m => m Exp -> m Exp -> m Exp
appE m Exp
x m Exp
y) forall a. a -> [a] -> [a]
: [m Exp]
zs )
thisModule :: Q Module
thisModule :: Q Module
thisModule = do
Loc
loc <- Q Loc
location
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ PkgName -> ModName -> Module
Module (String -> PkgName
mkPkgName forall a b. (a -> b) -> a -> b
$ Loc -> String
loc_package Loc
loc) (String -> ModName
mkModName forall a b. (a -> b) -> a -> b
$ Loc -> String
loc_module Loc
loc)
withDecDoc :: String -> Q Dec -> Q Dec
withDecDoc :: String -> Q Dec -> Q Dec
withDecDoc String
doc Q Dec
dec = do
Dec
dec' <- Q Dec
dec
case Dec -> Maybe DocLoc
doc_loc Dec
dec' of
Just DocLoc
loc -> forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Quasi m => DocLoc -> String -> m ()
qPutDoc DocLoc
loc String
doc
Maybe DocLoc
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure Dec
dec'
where
doc_loc :: Dec -> Maybe DocLoc
doc_loc (FunD Name
n [Clause]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (ValD (VarP Name
n) Body
_ [Dec]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (DataD [Type]
_ Name
n [TyVarBndr ()]
_ Maybe Type
_ [Con]
_ [DerivClause]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (NewtypeD [Type]
_ Name
n [TyVarBndr ()]
_ Maybe Type
_ Con
_ [DerivClause]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (TySynD Name
n [TyVarBndr ()]
_ Type
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (ClassD [Type]
_ Name
n [TyVarBndr ()]
_ [FunDep]
_ [Dec]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (SigD Name
n Type
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (ForeignD (ImportF Callconv
_ Safety
_ String
_ Name
n Type
_)) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (ForeignD (ExportF Callconv
_ String
_ Name
n Type
_)) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (InfixD Fixity
_ Name
n) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (DataFamilyD Name
n [TyVarBndr ()]
_ Maybe Type
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (OpenTypeFamilyD (TypeFamilyHead Name
n [TyVarBndr ()]
_ FamilyResultSig
_ Maybe InjectivityAnn
_)) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (ClosedTypeFamilyD (TypeFamilyHead Name
n [TyVarBndr ()]
_ FamilyResultSig
_ Maybe InjectivityAnn
_) [TySynEqn]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (PatSynD Name
n PatSynArgs
_ PatSynDir
_ Pat
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (PatSynSigD Name
n Type
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Name -> DocLoc
DeclDoc Name
n
doc_loc (InstanceD Maybe Overlap
_ [Type]
_ Type
t [Dec]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Type -> DocLoc
InstDoc Type
t
doc_loc (DataInstD [Type]
_ Maybe [TyVarBndr ()]
_ Type
t Maybe Type
_ [Con]
_ [DerivClause]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Type -> DocLoc
InstDoc Type
t
doc_loc (NewtypeInstD [Type]
_ Maybe [TyVarBndr ()]
_ Type
t Maybe Type
_ Con
_ [DerivClause]
_) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Type -> DocLoc
InstDoc Type
t
doc_loc (TySynInstD (TySynEqn Maybe [TyVarBndr ()]
_ Type
t Type
_)) = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Type -> DocLoc
InstDoc Type
t
doc_loc (ValD Pat
_ Body
_ [Dec]
_) = forall a. Maybe a
Nothing
doc_loc (KiSigD Name
_ Type
_) = forall a. Maybe a
Nothing
doc_loc (PragmaD Pragma
_) = forall a. Maybe a
Nothing
doc_loc (RoleAnnotD Name
_ [Role]
_) = forall a. Maybe a
Nothing
doc_loc (StandaloneDerivD Maybe DerivStrategy
_ [Type]
_ Type
_) = forall a. Maybe a
Nothing
doc_loc (DefaultSigD Name
_ Type
_) = forall a. Maybe a
Nothing
doc_loc (ImplicitParamBindD String
_ Exp
_) = forall a. Maybe a
Nothing
doc_loc (DefaultD [Type]
_) = forall a. Maybe a
Nothing
withDecsDoc :: String -> Q [Dec] -> Q [Dec]
withDecsDoc :: String -> Q [Dec] -> Q [Dec]
withDecsDoc String
doc Q [Dec]
decs = Q [Dec]
decs forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (String -> Q Dec -> Q Dec
withDecDoc String
doc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Applicative f => a -> f a
pure)
funD_doc :: Name -> [Q Clause]
-> Maybe String
-> [Maybe String]
-> Q Dec
funD_doc :: Name -> [Q Clause] -> Maybe String -> [Maybe String] -> Q Dec
funD_doc Name
nm [Q Clause]
cs Maybe String
mfun_doc [Maybe String]
arg_docs = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_
[DocLoc -> String -> Q ()
putDoc (Name -> Int -> DocLoc
ArgDoc Name
nm Int
i) String
s | (Int
i, Just String
s) <- forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] [Maybe String]
arg_docs]
let dec :: Q Dec
dec = forall (m :: * -> *). Quote m => Name -> [m Clause] -> m Dec
funD Name
nm [Q Clause]
cs
case Maybe String
mfun_doc of
Just String
fun_doc -> String -> Q Dec -> Q Dec
withDecDoc String
fun_doc Q Dec
dec
Maybe String
Nothing -> forall (m :: * -> *). Quote m => Name -> [m Clause] -> m Dec
funD Name
nm [Q Clause]
cs
dataD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind)
-> [(Q Con, Maybe String, [Maybe String])]
-> [Q DerivClause]
-> Maybe String
-> Q Dec
dataD_doc :: Q [Type]
-> Name
-> [Q (TyVarBndr ())]
-> Maybe (Q Type)
-> [(Q Con, Maybe String, [Maybe String])]
-> [Q DerivClause]
-> Maybe String
-> Q Dec
dataD_doc Q [Type]
ctxt Name
tc [Q (TyVarBndr ())]
tvs Maybe (Q Type)
ksig [(Q Con, Maybe String, [Maybe String])]
cons_with_docs [Q DerivClause]
derivs Maybe String
mdoc = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons [(Q Con, Maybe String, [Maybe String])]
cons_with_docs
let dec :: Q Dec
dec = forall (m :: * -> *).
Quote m =>
m [Type]
-> Name
-> [m (TyVarBndr ())]
-> Maybe (m Type)
-> [m Con]
-> [m DerivClause]
-> m Dec
dataD Q [Type]
ctxt Name
tc [Q (TyVarBndr ())]
tvs Maybe (Q Type)
ksig (forall a b. (a -> b) -> [a] -> [b]
map (\(Q Con
con, Maybe String
_, [Maybe String]
_) -> Q Con
con) [(Q Con, Maybe String, [Maybe String])]
cons_with_docs) [Q DerivClause]
derivs
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Q Dec
dec (forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> Q Dec -> Q Dec
withDecDoc Q Dec
dec) Maybe String
mdoc
newtypeD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind)
-> (Q Con, Maybe String, [Maybe String])
-> [Q DerivClause]
-> Maybe String
-> Q Dec
newtypeD_doc :: Q [Type]
-> Name
-> [Q (TyVarBndr ())]
-> Maybe (Q Type)
-> (Q Con, Maybe String, [Maybe String])
-> [Q DerivClause]
-> Maybe String
-> Q Dec
newtypeD_doc Q [Type]
ctxt Name
tc [Q (TyVarBndr ())]
tvs Maybe (Q Type)
ksig con_with_docs :: (Q Con, Maybe String, [Maybe String])
con_with_docs@(Q Con
con, Maybe String
_, [Maybe String]
_) [Q DerivClause]
derivs Maybe String
mdoc = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons (Q Con, Maybe String, [Maybe String])
con_with_docs
let dec :: Q Dec
dec = forall (m :: * -> *).
Quote m =>
m [Type]
-> Name
-> [m (TyVarBndr ())]
-> Maybe (m Type)
-> m Con
-> [m DerivClause]
-> m Dec
newtypeD Q [Type]
ctxt Name
tc [Q (TyVarBndr ())]
tvs Maybe (Q Type)
ksig Q Con
con [Q DerivClause]
derivs
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Q Dec
dec (forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> Q Dec -> Q Dec
withDecDoc Q Dec
dec) Maybe String
mdoc
dataInstD_doc :: Q Cxt -> (Maybe [Q (TyVarBndr ())]) -> Q Type -> Maybe (Q Kind)
-> [(Q Con, Maybe String, [Maybe String])]
-> [Q DerivClause]
-> Maybe String
-> Q Dec
dataInstD_doc :: Q [Type]
-> Maybe [Q (TyVarBndr ())]
-> Q Type
-> Maybe (Q Type)
-> [(Q Con, Maybe String, [Maybe String])]
-> [Q DerivClause]
-> Maybe String
-> Q Dec
dataInstD_doc Q [Type]
ctxt Maybe [Q (TyVarBndr ())]
mb_bndrs Q Type
ty Maybe (Q Type)
ksig [(Q Con, Maybe String, [Maybe String])]
cons_with_docs [Q DerivClause]
derivs Maybe String
mdoc = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons [(Q Con, Maybe String, [Maybe String])]
cons_with_docs
let dec :: Q Dec
dec = forall (m :: * -> *).
Quote m =>
m [Type]
-> Maybe [m (TyVarBndr ())]
-> m Type
-> Maybe (m Type)
-> [m Con]
-> [m DerivClause]
-> m Dec
dataInstD Q [Type]
ctxt Maybe [Q (TyVarBndr ())]
mb_bndrs Q Type
ty Maybe (Q Type)
ksig (forall a b. (a -> b) -> [a] -> [b]
map (\(Q Con
con, Maybe String
_, [Maybe String]
_) -> Q Con
con) [(Q Con, Maybe String, [Maybe String])]
cons_with_docs)
[Q DerivClause]
derivs
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Q Dec
dec (forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> Q Dec -> Q Dec
withDecDoc Q Dec
dec) Maybe String
mdoc
newtypeInstD_doc :: Q Cxt -> (Maybe [Q (TyVarBndr ())]) -> Q Type
-> Maybe (Q Kind)
-> (Q Con, Maybe String, [Maybe String])
-> [Q DerivClause]
-> Maybe String
-> Q Dec
newtypeInstD_doc :: Q [Type]
-> Maybe [Q (TyVarBndr ())]
-> Q Type
-> Maybe (Q Type)
-> (Q Con, Maybe String, [Maybe String])
-> [Q DerivClause]
-> Maybe String
-> Q Dec
newtypeInstD_doc Q [Type]
ctxt Maybe [Q (TyVarBndr ())]
mb_bndrs Q Type
ty Maybe (Q Type)
ksig con_with_docs :: (Q Con, Maybe String, [Maybe String])
con_with_docs@(Q Con
con, Maybe String
_, [Maybe String]
_) [Q DerivClause]
derivs Maybe String
mdoc = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons (Q Con, Maybe String, [Maybe String])
con_with_docs
let dec :: Q Dec
dec = forall (m :: * -> *).
Quote m =>
m [Type]
-> Maybe [m (TyVarBndr ())]
-> m Type
-> Maybe (m Type)
-> m Con
-> [m DerivClause]
-> m Dec
newtypeInstD Q [Type]
ctxt Maybe [Q (TyVarBndr ())]
mb_bndrs Q Type
ty Maybe (Q Type)
ksig Q Con
con [Q DerivClause]
derivs
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Q Dec
dec (forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> Q Dec -> Q Dec
withDecDoc Q Dec
dec) Maybe String
mdoc
patSynD_doc :: Name -> Q PatSynArgs -> Q PatSynDir -> Q Pat
-> Maybe String
-> [Maybe String]
-> Q Dec
patSynD_doc :: Name
-> Q PatSynArgs
-> Q PatSynDir
-> Q Pat
-> Maybe String
-> [Maybe String]
-> Q Dec
patSynD_doc Name
name Q PatSynArgs
args Q PatSynDir
dir Q Pat
pat Maybe String
mdoc [Maybe String]
arg_docs = do
forall (m :: * -> *). Quasi m => Q () -> m ()
qAddModFinalizer forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_
[DocLoc -> String -> Q ()
putDoc (Name -> Int -> DocLoc
ArgDoc Name
name Int
i) String
s | (Int
i, Just String
s) <- forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] [Maybe String]
arg_docs]
let dec :: Q Dec
dec = forall (m :: * -> *).
Quote m =>
Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
patSynD Name
name Q PatSynArgs
args Q PatSynDir
dir Q Pat
pat
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Q Dec
dec (forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> Q Dec -> Q Dec
withDecDoc Q Dec
dec) Maybe String
mdoc
docCons :: (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons :: (Q Con, Maybe String, [Maybe String]) -> Q ()
docCons (Q Con
c, Maybe String
md, [Maybe String]
arg_docs) = do
Con
c' <- Q Con
c
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [ DocLoc -> String -> Q ()
putDoc (Name -> DocLoc
DeclDoc Name
nm) String
d | Just String
d <- [Maybe String
md], Name
nm <- Con -> [Name]
get_cons_names Con
c' ]
case Con
c' of
RecC Name
_ [VarBangType]
var_bang_types ->
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [ DocLoc -> String -> Q ()
putDoc (Name -> DocLoc
DeclDoc Name
nm) String
arg_doc
| (Just String
arg_doc, (Name
nm, Strict
_, Type
_)) <- forall a b. [a] -> [b] -> [(a, b)]
zip [Maybe String]
arg_docs [VarBangType]
var_bang_types
]
Con
_ ->
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ [ DocLoc -> String -> Q ()
putDoc (Name -> Int -> DocLoc
ArgDoc Name
nm Int
i) String
arg_doc
| Name
nm <- Con -> [Name]
get_cons_names Con
c'
, (Int
i, Just String
arg_doc) <- forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] [Maybe String]
arg_docs
]
where
get_cons_names :: Con -> [Name]
get_cons_names :: Con -> [Name]
get_cons_names (NormalC Name
n [BangType]
_) = [Name
n]
get_cons_names (RecC Name
n [VarBangType]
_) = [Name
n]
get_cons_names (InfixC BangType
_ Name
n BangType
_) = [Name
n]
get_cons_names (ForallC [TyVarBndr Specificity]
_ [Type]
_ Con
cons) = Con -> [Name]
get_cons_names Con
cons
get_cons_names (GadtC [Name]
ns [BangType]
_ Type
_) = [Name]
ns
get_cons_names (RecGadtC [Name]
ns [VarBangType]
_ Type
_) = [Name]
ns