-- |-- Language.Haskell.TH.Lib.Internal exposes some additional functionality that-- is used internally in GHC's integration with Template Haskell. This is not a-- part of the public API, and as such, there are no API guarantees for this-- module from version to version.-- Why do we have both Language.Haskell.TH.Lib.Internal and-- Language.Haskell.TH.Lib? Ultimately, it's because the functions in the-- former (which are tailored for GHC's use) need different type signatures-- than the ones in the latter. Syncing up the Internal type signatures would-- involve a massive amount of breaking changes, so for the time being, we-- relegate as many changes as we can to just the Internal module, where it-- is safe to break things.moduleLanguage.Haskell.TH.Lib.InternalwhereimportLanguage.Haskell.TH.Syntax hiding(Role ,InjectivityAnn )importqualifiedLanguage.Haskell.TH.Syntax asTHimportControl.Monad(liftM,liftM2)importData.Word(Word8)------------------------------------------------------------ * Type synonyms----------------------------------------------------------typeInfoQ =Q Info typePatQ =Q Pat typeFieldPatQ =Q FieldPat typeExpQ =Q Exp typeTExpQ a =Q (TExp a )typeDecQ =Q Dec typeDecsQ =Q [Dec ]typeConQ =Q Con typeTypeQ =Q Type typeKindQ =Q Kind typeTyVarBndrQ =Q TyVarBndr typeTyLitQ =Q TyLit typeCxtQ =Q Cxt typePredQ =Q Pred typeDerivClauseQ =Q DerivClause typeMatchQ =Q Match typeClauseQ =Q Clause typeBodyQ =Q Body typeGuardQ =Q Guard typeStmtQ =Q Stmt typeRangeQ =Q Range typeSourceStrictnessQ =Q SourceStrictness typeSourceUnpackednessQ =Q SourceUnpackedness typeBangQ =Q Bang typeBangTypeQ =Q BangType typeVarBangTypeQ =Q VarBangType typeStrictTypeQ =Q StrictType typeVarStrictTypeQ =Q VarStrictType typeFieldExpQ =Q FieldExp typeRuleBndrQ =Q RuleBndr typeTySynEqnQ =Q TySynEqn typePatSynDirQ =Q PatSynDir typePatSynArgsQ =Q PatSynArgs typeFamilyResultSigQ =Q FamilyResultSig -- must be defined here for DsMeta to find ittypeRole =TH.Role typeInjectivityAnn =TH.InjectivityAnn ------------------------------------------------------------ * Lowercase pattern syntax functions----------------------------------------------------------intPrimL::Integer->Lit intPrimL =IntPrimL wordPrimL::Integer->Lit wordPrimL =WordPrimL floatPrimL::Rational->Lit floatPrimL =FloatPrimL doublePrimL::Rational->Lit doublePrimL =DoublePrimL integerL::Integer->Lit integerL =IntegerL charL::Char->Lit charL =CharL charPrimL::Char->Lit charPrimL =CharPrimL stringL::String->Lit stringL =StringL stringPrimL::[Word8]->Lit stringPrimL =StringPrimL rationalL::Rational->Lit rationalL =RationalL litP::Lit ->PatQ litP l =return(LitP l )varP::Name ->PatQ varP v =return(VarP v )tupP::[PatQ ]->PatQ tupP ps =do{ps1 <-sequenceps ;return(TupP ps1 )}unboxedTupP::[PatQ ]->PatQ unboxedTupP ps =do{ps1 <-sequenceps ;return(UnboxedTupP ps1 )}unboxedSumP::PatQ ->SumAlt ->SumArity ->PatQ unboxedSumP p alt arity =do{p1 <-p ;return(UnboxedSumP p1 alt arity )}conP::Name ->[PatQ ]->PatQ conP n ps =dops' <-sequenceps return(ConP n ps' )infixP::PatQ ->Name ->PatQ ->PatQ infixP p1 n p2 =dop1' <-p1 p2' <-p2 return(InfixP p1' n p2' )uInfixP::PatQ ->Name ->PatQ ->PatQ uInfixP p1 n p2 =dop1' <-p1 p2' <-p2 return(UInfixP p1' n p2' )parensP::PatQ ->PatQ parensP p =dop' <-p return(ParensP p' )tildeP::PatQ ->PatQ tildeP p =dop' <-p return(TildeP p' )bangP::PatQ ->PatQ bangP p =dop' <-p return(BangP p' )asP::Name ->PatQ ->PatQ asP n p =dop' <-p return(AsP n p' )wildP::PatQ wildP =returnWildP recP::Name ->[FieldPatQ ]->PatQ recP n fps =dofps' <-sequencefps return(RecP n fps' )listP::[PatQ ]->PatQ listP ps =dops' <-sequenceps return(ListP ps' )sigP::PatQ ->TypeQ ->PatQ sigP p t =dop' <-p t' <-t return(SigP p' t' )viewP::ExpQ ->PatQ ->PatQ viewP e p =doe' <-e p' <-p return(ViewP e' p' )fieldPat::Name ->PatQ ->FieldPatQ fieldPat n p =dop' <-p return(n ,p' )--------------------------------------------------------------------------------- * StmtbindS::PatQ ->ExpQ ->StmtQ bindS p e =liftM2BindS p e letS::[DecQ ]->StmtQ letS ds =do{ds1 <-sequenceds ;return(LetS ds1 )}noBindS::ExpQ ->StmtQ noBindS e =do{e1 <-e ;return(NoBindS e1 )}parS::[[StmtQ ]]->StmtQ parS sss =do{sss1 <-mapMsequencesss ;return(ParS sss1 )}--------------------------------------------------------------------------------- * RangefromR::ExpQ ->RangeQ fromR x =do{a <-x ;return(FromR a )}fromThenR::ExpQ ->ExpQ ->RangeQ fromThenR x y =do{a <-x ;b <-y ;return(FromThenR a b )}fromToR::ExpQ ->ExpQ ->RangeQ fromToR x y =do{a <-x ;b <-y ;return(FromToR a b )}fromThenToR::ExpQ ->ExpQ ->ExpQ ->RangeQ fromThenToR x y z =do{a <-x ;b <-y ;c <-z ;return(FromThenToR a b c )}--------------------------------------------------------------------------------- * BodynormalB::ExpQ ->BodyQ normalB e =do{e1 <-e ;return(NormalB e1 )}guardedB::[Q (Guard ,Exp )]->BodyQ guardedB ges =do{ges' <-sequenceges ;return(GuardedB ges' )}--------------------------------------------------------------------------------- * GuardnormalG::ExpQ ->GuardQ normalG e =do{e1 <-e ;return(NormalG e1 )}normalGE::ExpQ ->ExpQ ->Q (Guard ,Exp )normalGE g e =do{g1 <-g ;e1 <-e ;return(NormalG g1 ,e1 )}patG::[StmtQ ]->GuardQ patG ss =do{ss' <-sequencess ;return(PatG ss' )}patGE::[StmtQ ]->ExpQ ->Q (Guard ,Exp )patGE ss e =do{ss' <-sequencess ;e' <-e ;return(PatG ss' ,e' )}--------------------------------------------------------------------------------- * Match and Clause-- | Use with 'caseE'match::PatQ ->BodyQ ->[DecQ ]->MatchQ match p rhs ds =do{p' <-p ;r' <-rhs ;ds' <-sequenceds ;return(Match p' r' ds' )}-- | Use with 'funD'clause::[PatQ ]->BodyQ ->[DecQ ]->ClauseQ clause ps r ds =do{ps' <-sequenceps ;r' <-r ;ds' <-sequenceds ;return(Clause ps' r' ds' )}----------------------------------------------------------------------------- * Exp-- | Dynamically binding a variable (unhygenic)dyn::String->ExpQ dyn s =return(VarE (mkName s ))varE::Name ->ExpQ varE s =return(VarE s )conE::Name ->ExpQ conE s =return(ConE s )litE::Lit ->ExpQ litE c =return(LitE c )appE::ExpQ ->ExpQ ->ExpQ appE x y =do{a <-x ;b <-y ;return(AppE a b )}appTypeE::ExpQ ->TypeQ ->ExpQ appTypeE x t =do{a <-x ;s <-t ;return(AppTypeE a s )}parensE::ExpQ ->ExpQ parensE x =do{x' <-x ;return(ParensE x' )}uInfixE::ExpQ ->ExpQ ->ExpQ ->ExpQ uInfixE x s y =do{x' <-x ;s' <-s ;y' <-y ;return(UInfixE x' s' y' )}infixE::MaybeExpQ ->ExpQ ->MaybeExpQ ->ExpQ infixE (Justx )s (Justy )=do{a <-x ;s' <-s ;b <-y ;return(InfixE (Justa )s' (Justb ))}infixENothings (Justy )=do{s' <-s ;b <-y ;return(InfixE Nothings' (Justb ))}infixE(Justx )s Nothing=do{a <-x ;s' <-s ;return(InfixE (Justa )s' Nothing)}infixENothings Nothing=do{s' <-s ;return(InfixE Nothings' Nothing)}infixApp::ExpQ ->ExpQ ->ExpQ ->ExpQ infixApp x y z =infixE (Justx )y (Justz )sectionL::ExpQ ->ExpQ ->ExpQ sectionL x y =infixE (Justx )y NothingsectionR::ExpQ ->ExpQ ->ExpQ sectionR x y =infixE Nothingx (Justy )lamE::[PatQ ]->ExpQ ->ExpQ lamE ps e =dops' <-sequenceps e' <-e return(LamE ps' e' )-- | Single-arg lambdalam1E::PatQ ->ExpQ ->ExpQ lam1E p e =lamE [p ]e lamCaseE::[MatchQ ]->ExpQ lamCaseE ms =sequencems >>=return.LamCaseE tupE::[ExpQ ]->ExpQ tupE es =do{es1 <-sequencees ;return(TupE es1 )}unboxedTupE::[ExpQ ]->ExpQ unboxedTupE es =do{es1 <-sequencees ;return(UnboxedTupE es1 )}unboxedSumE::ExpQ ->SumAlt ->SumArity ->ExpQ unboxedSumE e alt arity =do{e1 <-e ;return(UnboxedSumE e1 alt arity )}condE::ExpQ ->ExpQ ->ExpQ ->ExpQ condE x y z =do{a <-x ;b <-y ;c <-z ;return(CondE a b c )}multiIfE::[Q (Guard ,Exp )]->ExpQ multiIfE alts =sequencealts >>=return.MultiIfE letE::[DecQ ]->ExpQ ->ExpQ letE ds e =do{ds2 <-sequenceds ;e2 <-e ;return(LetE ds2 e2 )}caseE::ExpQ ->[MatchQ ]->ExpQ caseE e ms =do{e1 <-e ;ms1 <-sequencems ;return(CaseE e1 ms1 )}doE::[StmtQ ]->ExpQ doE ss =do{ss1 <-sequencess ;return(DoE ss1 )}compE::[StmtQ ]->ExpQ compE ss =do{ss1 <-sequencess ;return(CompE ss1 )}arithSeqE::RangeQ ->ExpQ arithSeqE r =do{r' <-r ;return(ArithSeqE r' )}listE::[ExpQ ]->ExpQ listE es =do{es1 <-sequencees ;return(ListE es1 )}sigE::ExpQ ->TypeQ ->ExpQ sigE e t =do{e1 <-e ;t1 <-t ;return(SigE e1 t1 )}recConE::Name ->[Q (Name ,Exp )]->ExpQ recConE c fs =do{flds <-sequencefs ;return(RecConE c flds )}recUpdE::ExpQ ->[Q (Name ,Exp )]->ExpQ recUpdE e fs =do{e1 <-e ;flds <-sequencefs ;return(RecUpdE e1 flds )}stringE::String->ExpQ stringE =litE .stringL fieldExp::Name ->ExpQ ->Q (Name ,Exp )fieldExp s e =do{e' <-e ;return(s ,e' )}-- | @staticE x = [| static x |]@staticE::ExpQ ->ExpQ staticE =fmapStaticE unboundVarE::Name ->ExpQ unboundVarE s =return(UnboundVarE s )labelE::String->ExpQ labelE s =return(LabelE s )-- ** 'arithSeqE' ShortcutsfromE::ExpQ ->ExpQ fromE x =do{a <-x ;return(ArithSeqE (FromR a ))}fromThenE::ExpQ ->ExpQ ->ExpQ fromThenE x y =do{a <-x ;b <-y ;return(ArithSeqE (FromThenR a b ))}fromToE::ExpQ ->ExpQ ->ExpQ fromToE x y =do{a <-x ;b <-y ;return(ArithSeqE (FromToR a b ))}fromThenToE::ExpQ ->ExpQ ->ExpQ ->ExpQ fromThenToE x y z =do{a <-x ;b <-y ;c <-z ;return(ArithSeqE (FromThenToR a b c ))}--------------------------------------------------------------------------------- * DecvalD::PatQ ->BodyQ ->[DecQ ]->DecQ valD p b ds =do{p' <-p ;ds' <-sequenceds ;b' <-b ;return(ValD p' b' ds' )}funD::Name ->[ClauseQ ]->DecQ funD nm cs =do{cs1 <-sequencecs ;return(FunD nm cs1 )}tySynD::Name ->[TyVarBndrQ ]->TypeQ ->DecQ tySynD tc tvs rhs =do{tvs1 <-sequenceAtvs ;rhs1 <-rhs ;return(TySynD tc tvs1 rhs1 )}dataD::CxtQ ->Name ->[TyVarBndrQ ]->MaybeKindQ ->[ConQ ]->[DerivClauseQ ]->DecQ dataD ctxt tc tvs ksig cons derivs =doctxt1 <-ctxt tvs1 <-sequenceAtvs ksig1 <-sequenceAksig cons1 <-sequencecons derivs1 <-sequencederivs return(DataD ctxt1 tc tvs1 ksig1 cons1 derivs1 )newtypeD::CxtQ ->Name ->[TyVarBndrQ ]->MaybeKindQ ->ConQ ->[DerivClauseQ ]->DecQ newtypeD ctxt tc tvs ksig con derivs =doctxt1 <-ctxt tvs1 <-sequenceAtvs ksig1 <-sequenceAksig con1 <-con derivs1 <-sequencederivs return(NewtypeD ctxt1 tc tvs1 ksig1 con1 derivs1 )classD::CxtQ ->Name ->[TyVarBndrQ ]->[FunDep ]->[DecQ ]->DecQ classD ctxt cls tvs fds decs =dotvs1 <-sequenceAtvs decs1 <-sequenceAdecs ctxt1 <-ctxt return$ClassD ctxt1 cls tvs1 fds decs1 instanceD::CxtQ ->TypeQ ->[DecQ ]->DecQ instanceD =instanceWithOverlapD NothinginstanceWithOverlapD::MaybeOverlap ->CxtQ ->TypeQ ->[DecQ ]->DecQ instanceWithOverlapD o ctxt ty decs =doctxt1 <-ctxt decs1 <-sequencedecs ty1 <-ty return$InstanceD o ctxt1 ty1 decs1 sigD::Name ->TypeQ ->DecQ sigD fun ty =liftM(SigD fun )$ty forImpD::Callconv ->Safety ->String->Name ->TypeQ ->DecQ forImpD cc s str n ty =doty' <-ty return$ForeignD (ImportF cc s str n ty' )infixLD::Int->Name ->DecQ infixLD prec nm =return(InfixD (Fixity prec InfixL )nm )infixRD::Int->Name ->DecQ infixRD prec nm =return(InfixD (Fixity prec InfixR )nm )infixND::Int->Name ->DecQ infixND prec nm =return(InfixD (Fixity prec InfixN )nm )pragInlD::Name ->Inline ->RuleMatch ->Phases ->DecQ pragInlD name inline rm phases =return$PragmaD $InlineP name inline rm phases pragSpecD::Name ->TypeQ ->Phases ->DecQ pragSpecD n ty phases =doty1 <-ty return$PragmaD $SpecialiseP n ty1 Nothingphases pragSpecInlD::Name ->TypeQ ->Inline ->Phases ->DecQ pragSpecInlD n ty inline phases =doty1 <-ty return$PragmaD $SpecialiseP n ty1 (Justinline )phases pragSpecInstD::TypeQ ->DecQ pragSpecInstD ty =doty1 <-ty return$PragmaD $SpecialiseInstP ty1 pragRuleD::String->[RuleBndrQ ]->ExpQ ->ExpQ ->Phases ->DecQ pragRuleD n bndrs lhs rhs phases =dobndrs1 <-sequencebndrs lhs1 <-lhs rhs1 <-rhs return$PragmaD $RuleP n bndrs1 lhs1 rhs1 phases pragAnnD::AnnTarget ->ExpQ ->DecQ pragAnnD target expr =doexp1 <-expr return$PragmaD $AnnP target exp1 pragLineD::Int->String->DecQ pragLineD line file =return$PragmaD $LineP line file pragCompleteD::[Name ]->MaybeName ->DecQ pragCompleteD cls mty =return$PragmaD $CompleteP cls mty dataInstD::CxtQ ->Name ->[TypeQ ]->MaybeKindQ ->[ConQ ]->[DerivClauseQ ]->DecQ dataInstD ctxt tc tys ksig cons derivs =doctxt1 <-ctxt tys1 <-sequenceAtys ksig1 <-sequenceAksig cons1 <-sequenceAcons derivs1 <-sequenceAderivs return(DataInstD ctxt1 tc tys1 ksig1 cons1 derivs1 )newtypeInstD::CxtQ ->Name ->[TypeQ ]->MaybeKindQ ->ConQ ->[DerivClauseQ ]->DecQ newtypeInstD ctxt tc tys ksig con derivs =doctxt1 <-ctxt tys1 <-sequenceAtys ksig1 <-sequenceAksig con1 <-con derivs1 <-sequencederivs return(NewtypeInstD ctxt1 tc tys1 ksig1 con1 derivs1 )tySynInstD::Name ->TySynEqnQ ->DecQ tySynInstD tc eqn =doeqn1 <-eqn return(TySynInstD tc eqn1 )dataFamilyD::Name ->[TyVarBndrQ ]->MaybeKindQ ->DecQ dataFamilyD tc tvs kind =dotvs' <-sequenceAtvs kind' <-sequenceAkind return$DataFamilyD tc tvs' kind' openTypeFamilyD::Name ->[TyVarBndrQ ]->FamilyResultSigQ ->MaybeInjectivityAnn ->DecQ openTypeFamilyD tc tvs res inj =dotvs' <-sequenceAtvs res' <-res return$OpenTypeFamilyD (TypeFamilyHead tc tvs' res' inj )closedTypeFamilyD::Name ->[TyVarBndrQ ]->FamilyResultSigQ ->MaybeInjectivityAnn ->[TySynEqnQ ]->DecQ closedTypeFamilyD tc tvs result injectivity eqns =dotvs1 <-sequenceAtvs result1 <-result eqns1 <-sequenceAeqns return(ClosedTypeFamilyD (TypeFamilyHead tc tvs1 result1 injectivity )eqns1 )roleAnnotD::Name ->[Role ]->DecQ roleAnnotD name roles =return$RoleAnnotD name roles standaloneDerivD::CxtQ ->TypeQ ->DecQ standaloneDerivD =standaloneDerivWithStrategyD NothingstandaloneDerivWithStrategyD::MaybeDerivStrategy ->CxtQ ->TypeQ ->DecQ standaloneDerivWithStrategyD ds ctxtq tyq =doctxt <-ctxtq ty <-tyq return$StandaloneDerivD ds ctxt ty defaultSigD::Name ->TypeQ ->DecQ defaultSigD n tyq =doty <-tyq return$DefaultSigD n ty -- | Pattern synonym declarationpatSynD::Name ->PatSynArgsQ ->PatSynDirQ ->PatQ ->DecQ patSynD name args dir pat =doargs' <-args dir' <-dir pat' <-pat return(PatSynD name args' dir' pat' )-- | Pattern synonym type signaturepatSynSigD::Name ->TypeQ ->DecQ patSynSigD nm ty =doty' <-ty return$PatSynSigD nm ty' tySynEqn::[TypeQ ]->TypeQ ->TySynEqnQ tySynEqn lhs rhs =dolhs1 <-sequencelhs rhs1 <-rhs return(TySynEqn lhs1 rhs1 )cxt::[PredQ ]->CxtQ cxt =sequencederivClause::MaybeDerivStrategy ->[PredQ ]->DerivClauseQ derivClause ds p =dop' <-cxt p return$DerivClause ds p' normalC::Name ->[BangTypeQ ]->ConQ normalC con strtys =liftM(NormalC con )$sequencestrtys recC::Name ->[VarBangTypeQ ]->ConQ recC con varstrtys =liftM(RecC con )$sequencevarstrtys infixC::Q (Bang ,Type )->Name ->Q (Bang ,Type )->ConQ infixC st1 con st2 =dost1' <-st1 st2' <-st2 return$InfixC st1' con st2' forallC::[TyVarBndrQ ]->CxtQ ->ConQ ->ConQ forallC ns ctxt con =dons' <-sequenceAns ctxt' <-ctxt con' <-con pure$ForallC ns' ctxt' con' gadtC::[Name ]->[StrictTypeQ ]->TypeQ ->ConQ gadtC cons strtys ty =liftM2(GadtC cons )(sequencestrtys )ty recGadtC::[Name ]->[VarStrictTypeQ ]->TypeQ ->ConQ recGadtC cons varstrtys ty =liftM2(RecGadtC cons )(sequencevarstrtys )ty --------------------------------------------------------------------------------- * TypeforallT::[TyVarBndrQ ]->CxtQ ->TypeQ ->TypeQ forallT tvars ctxt ty =dotvars1 <-sequenceAtvars ctxt1 <-ctxt ty1 <-ty return$ForallT tvars1 ctxt1 ty1 varT::Name ->TypeQ varT =return.VarT conT::Name ->TypeQ conT =return.ConT infixT::TypeQ ->Name ->TypeQ ->TypeQ infixT t1 n t2 =dot1' <-t1 t2' <-t2 return(InfixT t1' n t2' )uInfixT::TypeQ ->Name ->TypeQ ->TypeQ uInfixT t1 n t2 =dot1' <-t1 t2' <-t2 return(UInfixT t1' n t2' )parensT::TypeQ ->TypeQ parensT t =dot' <-t return(ParensT t' )appT::TypeQ ->TypeQ ->TypeQ appT t1 t2 =dot1' <-t1 t2' <-t2 return$AppT t1' t2' arrowT::TypeQ arrowT =returnArrowT listT::TypeQ listT =returnListT litT::TyLitQ ->TypeQ litT l =fmapLitT l tupleT::Int->TypeQ tupleT i =return(TupleT i )unboxedTupleT::Int->TypeQ unboxedTupleT i =return(UnboxedTupleT i )unboxedSumT::SumArity ->TypeQ unboxedSumT arity =return(UnboxedSumT arity )sigT::TypeQ ->KindQ ->TypeQ sigT t k =dot' <-t k' <-k return$SigT t' k' equalityT::TypeQ equalityT =returnEqualityT wildCardT::TypeQ wildCardT =returnWildCardT {-# DEPRECATEDclassP"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 cla tys =dotysl <-sequencetys return(foldlAppT (ConT cla )tysl ){-# DEPRECATEDequalP"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 tleft tright =dotleft1 <-tleft tright1 <-tright eqT <-equalityT return(foldlAppT eqT [tleft1 ,tright1 ])promotedT::Name ->TypeQ promotedT =return.PromotedT promotedTupleT::Int->TypeQ promotedTupleT i =return(PromotedTupleT i )promotedNilT::TypeQ promotedNilT =returnPromotedNilT promotedConsT::TypeQ promotedConsT =returnPromotedConsT noSourceUnpackedness,sourceNoUnpack,sourceUnpack::SourceUnpackednessQ noSourceUnpackedness =returnNoSourceUnpackedness sourceNoUnpack =returnSourceNoUnpack sourceUnpack =returnSourceUnpack noSourceStrictness,sourceLazy,sourceStrict::SourceStrictnessQ noSourceStrictness =returnNoSourceStrictness sourceLazy =returnSourceLazy sourceStrict =returnSourceStrict {-# DEPRECATEDisStrict["Use 'bang'. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. ","Example usage: 'bang noSourceUnpackedness sourceStrict'"]#-}{-# DEPRECATEDnotStrict["Use 'bang'. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. ","Example usage: 'bang noSourceUnpackedness noSourceStrictness'"]#-}{-# DEPRECATEDunpacked["Use 'bang'. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. ","Example usage: 'bang sourceUnpack sourceStrict'"]#-}isStrict,notStrict,unpacked::Q Strict isStrict =bang noSourceUnpackedness sourceStrict notStrict =bang noSourceUnpackedness noSourceStrictness unpacked =bang sourceUnpack sourceStrict bang::SourceUnpackednessQ ->SourceStrictnessQ ->BangQ bang u s =dou' <-u s' <-s return(Bang u' s' )bangType::BangQ ->TypeQ ->BangTypeQ bangType =liftM2(,)varBangType::Name ->BangTypeQ ->VarBangTypeQ varBangType v bt =do(b ,t )<-bt return(v ,b ,t ){-# DEPRECATEDstrictType"As of @template-haskell-2.11.0.0@, 'StrictType' has been replaced by 'BangType'. Please use 'bangType' instead."#-}strictType::Q Strict ->TypeQ ->StrictTypeQ strictType =bangType {-# DEPRECATEDvarStrictType"As of @template-haskell-2.11.0.0@, 'VarStrictType' has been replaced by 'VarBangType'. Please use 'varBangType' instead."#-}varStrictType::Name ->StrictTypeQ ->VarStrictTypeQ varStrictType =varBangType -- * Type LiteralsnumTyLit::Integer->TyLitQ numTyLit n =ifn >=0thenreturn(NumTyLit n )elsefail("Negative type-level number: "++shown )strTyLit::String->TyLitQ strTyLit s =return(StrTyLit s )--------------------------------------------------------------------------------- * KindplainTV::Name ->TyVarBndrQ plainTV =pure.PlainTV kindedTV::Name ->KindQ ->TyVarBndrQ kindedTV n =fmap(KindedTV n )varK::Name ->Kind varK =VarT conK::Name ->Kind conK =ConT tupleK::Int->Kind tupleK =TupleT arrowK::Kind arrowK =ArrowT listK::Kind listK =ListT appK::Kind ->Kind ->Kind appK =AppT starK::KindQ starK =pureStarT constraintK::KindQ constraintK =pureConstraintT --------------------------------------------------------------------------------- * Type family resultnoSig::FamilyResultSigQ noSig =pureNoSig kindSig::KindQ ->FamilyResultSigQ kindSig =fmapKindSig tyVarSig::TyVarBndrQ ->FamilyResultSigQ tyVarSig =fmapTyVarSig --------------------------------------------------------------------------------- * Injectivity annotationinjectivityAnn::Name ->[Name ]->InjectivityAnn injectivityAnn =TH.InjectivityAnn --------------------------------------------------------------------------------- * RolenominalR,representationalR,phantomR,inferR::Role nominalR =NominalR representationalR =RepresentationalR phantomR =PhantomR inferR =InferR --------------------------------------------------------------------------------- * CallconvcCall,stdCall,cApi,prim,javaScript::Callconv cCall =CCall stdCall =StdCall cApi =CApi prim=Prim javaScript =JavaScript --------------------------------------------------------------------------------- * Safetyunsafe,safe,interruptible::Safety unsafe=Unsafe safe=Safe interruptible =Interruptible --------------------------------------------------------------------------------- * FunDepfunDep::[Name ]->[Name ]->FunDep funDep =FunDep --------------------------------------------------------------------------------- * RuleBndrruleVar::Name ->RuleBndrQ ruleVar =return.RuleVar typedRuleVar::Name ->TypeQ ->RuleBndrQ typedRuleVar n ty =ty >>=return.TypedRuleVar n --------------------------------------------------------------------------------- * AnnTargetvalueAnnotation::Name ->AnnTarget valueAnnotation =ValueAnnotation typeAnnotation::Name ->AnnTarget typeAnnotation =TypeAnnotation moduleAnnotation::AnnTarget moduleAnnotation =ModuleAnnotation --------------------------------------------------------------------------------- * Pattern Synonyms (sub constructs)unidir,implBidir::PatSynDirQ unidir =returnUnidir implBidir =returnImplBidir explBidir::[ClauseQ ]->PatSynDirQ explBidir cls =docls' <-sequencecls return(ExplBidir cls' )prefixPatSyn::[Name ]->PatSynArgsQ prefixPatSyn args =return$PrefixPatSyn args recordPatSyn::[Name ]->PatSynArgsQ recordPatSyn sels =return$RecordPatSyn sels infixPatSyn::Name ->Name ->PatSynArgsQ infixPatSyn arg1 arg2 =return$InfixPatSyn arg1 arg2 ---------------------------------------------------------------- * Useful helper functionappsE::[ExpQ ]->ExpQ appsE []=error"appsE []"appsE[x ]=x appsE(x :y :zs )=appsE ((appE x y ):zs )-- | Return the Module at the place of splicing. Can be used as an-- input for 'reifyModule'.thisModule::Q Module thisModule =doloc <-location return$Module (mkPkgName $loc_packageloc )(mkModName $loc_moduleloc )

AltStyle によって変換されたページ (->オリジナル) /