-- | Utilities for constructing and destructing compound types and-- expressions.moduleDDC.Core.Eval.Compounds(moduleDDC.Core.Compounds-- * Types,tPair,tList-- * Witnesses,wGlobal,wConst,wMutable,wDistinct,wLazy,wManifest,wcGlobal,wcConst,wcMutable,wcDistinct,wcLazy,wcManifest,isCapConW-- * Expressions,takeMutableX-- * Units,isUnitX-- * Region Handles,takeHandleT,takeHandleX-- * Store Locations.,xLoc,takeLocX,stripLocX-- * Integers,tInt,tcInt,dcInt,takeIntDC,takeIntX)whereimportDDC.Core.Eval.NameimportDDC.Type.CompoundsimportDDC.Core.CompoundsimportDDC.Core.Exp-- Type ------------------------------------------------------------------------- | Application of the Pair type constructor.tPair::RegionName->TypeName->TypeName->TypeNametPairtRtAtB=tApps(TContcPair)[tR,tA,tB]wheretcPair=TyConBound(UPrim(NamePrimConPrimTyConPair)kPair)kPairkPair=kFuns[kRegion,kData,kData]kData-- | Application of the List type constructor.tList::RegionName->TypeName->TypeNametListtRtA=tApps(TContcList)[tR,tA]wheretcList=TyConBound(UPrim(NamePrimConPrimTyConList)kList)kListkList=kRegion`kFun`kData`kFun`kData-- Witness --------------------------------------------------------------------wGlobal::a->RegionName->WitnessaNamewGlobalar=WAppa(WConawcGlobal)(WTypear)wConst::a->RegionName->WitnessaNamewConstar=WAppa(WConawcConst)(WTypear)wMutable::a->RegionName->WitnessaNamewMutablear=WAppa(WConawcMutable)(WTypear)wLazy::a->RegionName->WitnessaNamewLazyar=WAppa(WConawcLazy)(WTypear)wManifest::a->RegionName->WitnessaNamewManifestar=WAppa(WConawcManifest)(WTypear)wDistinct::a->Int->[RegionName]->WitnessaNamewDistinctanrs=wAppsa(WCona(wcDistinctn))(map(WTypea)rs)-- Just the ConstructorswcGlobal::WiConNamewcGlobal=WiConBound(UPrim(NameCapCapGlobal)t)twheret=tForallkRegion$\r->tGlobalrwcConst::WiConNamewcConst=WiConBound(UPrim(NameCapCapConst)t)twheret=tForallkRegion$\r->tConstrwcMutable::WiConNamewcMutable=WiConBound(UPrim(NameCapCapMutable)t)twheret=tForallkRegion$\r->tMutablerwcLazy::WiConNamewcLazy=WiConBound(UPrim(NameCapCapLazy)t)twheret=tForallkRegion$\r->tLazyrwcManifest::WiConNamewcManifest=WiConBound(UPrim(NameCapCapManifest)t)twheret=tForallkRegion$\r->tManifestrwcDistinct::Int->WiConNamewcDistinctn=WiConBound(UPrim(NameCap(CapDistinctn))t)twheret=tForalls(replicatenkRegion)$\ts->tDistinctnts-- | Check whether a witness is a capability constructor.isCapConW::WitnessaName->BoolisCapConWww=casewwofWCon_WiConBound{}->True_->False-- Exp -------------------------------------------------------------------------- | Check whether an expression is the unit constructor.isUnitX::ExpaName->BoolisUnitXxx=casexxofXCon_dc->casedcofDaConUnit->True_->False_->False-- Handles ---------------------------------------- | Take a region handle from a type.takeHandleT::TypeName->MaybeRgntakeHandleTtt=casettofTVar(UPrim(NameRgnr1)_)->Justr1_->Nothing-- | Take a region handle from an expression.takeHandleX::ExpaName->MaybeRgntakeHandleXxx=casexxofXType_t->takeHandleTt_->Nothing-- Locations -------------------------------------- | Make a location expression.xLoc::Loc->TypeName->Exp()NamexLoclt=XVar()(UPrim(NameLocl)t)-- | Take a store location from an expression.-- We strip off 'forget' casts along the waytakeLocX::ExpaName->MaybeLoctakeLocXxx=casexxofXCast_(CastForget_)x->takeLocXxXVar_(UPrim(NameLocl)_)->Justl_->Nothing-- | Take a store location from an expression, reaching under any 'forget' casts.stripLocX::ExpaName->MaybeLocstripLocXxx=casexxofXCast_(CastForget_)x->stripLocXxXVar_(UPrim(NameLocl)_)->Justl_->Nothing-- Witnesses -------------------------------------- | Take a witness of mutability from an expression.takeMutableX::ExpaName->MaybeRgntakeMutableXxx=casexxofXWitness_(WApp_(WCon_wc)(WType_tR1))|WiConBound(UPrim(NameCapCapMutable)_)_<-wc->takeHandleTtR1_->Nothing-- Integers --------------------------------------- | Application of the Int type constructor.tInt::RegionName->TypeNametIntr1=TApp(TContcInt)r1-- | The integer type constructortcInt::TyConNametcInt=TyConBound(UPrim(NamePrimConPrimTyConInt)kInt)kIntwherekInt=kFunkRegionkData-- | Make an integer data constructor.dcInt::Integer->DaConNamedcInti=DaConPrim(NameInti)(TContcInt)-- | Take an integer literal from an data constructor.takeIntDC::DaConName->MaybeIntegertakeIntDCdc=casetakeNameOfDaCondcofJust(NameInti)->Justi_->Nothing-- | Take an integer literal from an expression.takeIntX::ExpaName->MaybeIntegertakeIntXxx=casexxofXCon_dc->takeIntDCdc_->Nothing