Skip to content

Commit 75eacbf

Browse files
committed
Unbundle binders from their role/expl attributes.
Fancy B-kinded things are a pain and they're about to get worse when we add decls to binders. An earlier attempt at adding decls without doing this forced me to create lots of complicated type classes to handle all the `WithExpl` and `RolePiBinder` variants.
1 parent c7fef43 commit 75eacbf

21 files changed

+543
-575
lines changed

src/lib/AbstractSyntax.hs

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,23 @@ topDecl = dropSrc topDecl' where
110110
topDecl' (CSDecl ann d) = ULocalDecl <$> decl ann (WithSrc emptySrcPosCtx d)
111111
topDecl' (CData name tyConParams givens constructors) = do
112112
tyConParams' <- aExplicitParams tyConParams
113-
givens' <- toNest <$> fromMaybeM givens [] aGivens
113+
givens' <- aOptGivens givens
114114
constructors' <- forM constructors \(v, ps) -> do
115115
ps' <- toNest <$> mapM tyOptBinder ps
116116
return (v, ps')
117117
return $ UDataDefDecl
118-
(UDataDef name (givens' >>> tyConParams') $
118+
(UDataDef name (catUOptAnnExplBinders givens' tyConParams') $
119119
map (\(name', cons) -> (name', UDataDefTrail cons)) constructors')
120120
(fromString name)
121121
(toNest $ map (fromString . fst) constructors')
122122
topDecl' (CStruct name params givens fields defs) = do
123123
params' <- aExplicitParams params
124-
givens' <- toNest <$> fromMaybeM givens [] aGivens
124+
givens' <- aOptGivens givens
125125
fields' <- forM fields \(v, ty) -> (v,) <$> expr ty
126126
methods <- forM defs \(ann, d) -> do
127127
(methodName, lam) <- aDef d
128128
return (ann, methodName, Abs (UBindSource emptySrcPosCtx "self") lam)
129-
return $ UStructDecl (fromString name) (UStructDef name (givens' >>> params') fields' methods)
129+
return $ UStructDecl (fromString name) (UStructDef name (catUOptAnnExplBinders givens' params') fields' methods)
130130
topDecl' (CInterface name params methods) = do
131131
params' <- aExplicitParams params
132132
(methodNames, methodTys) <- unzip <$> forM methods \(methodName, ty) -> do
@@ -153,7 +153,7 @@ aInstanceDef :: CInstanceDef -> SyntaxM (UTopDecl VoidS VoidS)
153153
aInstanceDef (CInstanceDef clName args givens methods instNameAndParams) = do
154154
let clName' = fromString clName
155155
args' <- mapM expr args
156-
givens' <- toNest <$> fromMaybeM givens [] aGivens
156+
givens' <- aOptGivens givens
157157
methods' <- catMaybes <$> mapM aMethod methods
158158
case instNameAndParams of
159159
Nothing -> return $ UInstance clName' givens' args' methods' NothingB ImplicitApp
@@ -162,7 +162,7 @@ aInstanceDef (CInstanceDef clName args givens methods instNameAndParams) = do
162162
case optParams of
163163
Just params -> do
164164
params' <- aExplicitParams params
165-
return $ UInstance clName' (givens' >>> params') args' methods' instName' ExplicitApp
165+
return $ UInstance clName' (catUOptAnnExplBinders givens' params') args' methods' instName' ExplicitApp
166166
Nothing -> return $ UInstance clName' givens' args' methods' instName' ImplicitApp
167167

168168
aDef :: CDef -> SyntaxM (SourceName, ULamExpr VoidS)
@@ -173,19 +173,27 @@ aDef (CDef name params optRhs optGivens body) = do
173173
effs <- fromMaybeM optEffs UPure aEffects
174174
resultTy' <- expr resultTy
175175
return (expl, Just effs, Just resultTy')
176-
implicitParams <- toNest <$> fromMaybeM optGivens [] aGivens
177-
let allParams = implicitParams >>> explicitParams
176+
implicitParams <- aOptGivens optGivens
177+
let allParams = catUOptAnnExplBinders implicitParams explicitParams
178178
body' <- block body
179179
return (name, ULamExpr allParams expl effs resultTy body')
180180

181+
catUOptAnnExplBinders :: UOptAnnExplBinders n l -> UOptAnnExplBinders l l' -> UOptAnnExplBinders n l'
182+
catUOptAnnExplBinders (expls, bs) (expls', bs') = (expls <> expls', bs >>> bs')
183+
181184
stripParens :: Group -> Group
182185
stripParens (WithSrc _ (CParens [g])) = stripParens g
183186
stripParens g = g
184187

185-
aExplicitParams :: ExplicitParams -> SyntaxM (Nest (WithExpl UOptAnnBinder) VoidS VoidS)
188+
aExplicitParams :: ExplicitParams -> SyntaxM ([Explicitness], Nest UOptAnnBinder VoidS VoidS)
186189
aExplicitParams gs = generalBinders DataParam Explicit gs
187190

188-
aGivens :: GivenClause -> SyntaxM [WithExpl UOptAnnBinder VoidS VoidS]
191+
aOptGivens :: Maybe GivenClause -> SyntaxM (UOptAnnExplBinders VoidS VoidS)
192+
aOptGivens optGivens = do
193+
(expls, implicitParams) <- unzip <$> fromMaybeM optGivens [] aGivens
194+
return (expls, toNest implicitParams)
195+
196+
aGivens :: GivenClause -> SyntaxM [(Explicitness, UOptAnnBinder VoidS VoidS)]
189197
aGivens (implicits, optConstraints) = do
190198
implicits' <- mapM (generalBinder DataParam (Inferred Nothing Unify)) implicits
191199
constraints <- fromMaybeM optConstraints [] \gs -> do
@@ -194,23 +202,24 @@ aGivens (implicits, optConstraints) = do
194202

195203
generalBinders
196204
:: ParamStyle -> Explicitness -> [Group]
197-
-> SyntaxM (Nest (WithExpl UOptAnnBinder) VoidS VoidS)
198-
generalBinders paramStyle expl params = toNest . concat <$>
199-
forM params \case
205+
-> SyntaxM ([Explicitness], Nest UOptAnnBinder VoidS VoidS)
206+
generalBinders paramStyle expl params = do
207+
(expls, bs) <- unzip . concat <$> forM params \case
200208
WithSrc _ (CGivens gs) -> aGivens gs
201209
p -> (:[]) <$> generalBinder paramStyle expl p
210+
return (expls, toNest bs)
202211

203212
generalBinder :: ParamStyle -> Explicitness -> Group
204-
-> SyntaxM (WithExpl UOptAnnBinder VoidS VoidS)
213+
-> SyntaxM (Explicitness, UOptAnnBinder VoidS VoidS)
205214
generalBinder paramStyle expl g = case expl of
206-
Inferred _ (Synth _) -> WithExpl expl <$> tyOptBinder g
215+
Inferred _ (Synth _) -> (expl,) <$> tyOptBinder g
207216
Inferred _ Unify -> do
208217
b <- binderOptTy g
209218
expl' <- return case b of
210219
UAnnBinder (UBindSource _ s) _ _ -> Inferred (Just s) Unify
211220
_ -> expl
212-
return $ WithExpl expl' b
213-
Explicit -> WithExpl expl <$> case paramStyle of
221+
return (expl', b)
222+
Explicit -> (expl,) <$> case paramStyle of
214223
TypeParam -> tyOptBinder g
215224
DataParam -> binderOptTy g
216225

@@ -347,7 +356,7 @@ aMethod (WithSrc src d) = Just . WithSrcE src <$> addSrcContext src case d of
347356
(name, lam) <- aDef def
348357
return $ UMethodDef (fromString name) lam
349358
CLet (WithSrc _ (CIdentifier name)) rhs -> do
350-
rhs' <- ULamExpr Empty ImplicitApp Nothing Nothing <$> block rhs
359+
rhs' <- ULamExpr ([], Empty) ImplicitApp Nothing Nothing <$> block rhs
351360
return $ UMethodDef (fromString name) rhs'
352361
_ -> throw SyntaxErr "Unexpected method definition. Expected `def` or `x = ...`."
353362

@@ -368,10 +377,10 @@ blockDecls [WithSrc src d] = addSrcContext src case d of
368377
CExpr g -> (Empty,) <$> expr g
369378
_ -> throw SyntaxErr "Block must end in expression"
370379
blockDecls (WithSrc pos (CBind b rhs):ds) = do
371-
WithExpl _ b' <- generalBinder DataParam Explicit b
380+
(_, b') <- generalBinder DataParam Explicit b
372381
rhs' <- asExpr <$> block rhs
373382
body <- block $ IndentedBlock ds
374-
let lam = ULam $ ULamExpr (UnaryNest (WithExpl Explicit b')) ExplicitApp Nothing Nothing body
383+
let lam = ULam $ ULamExpr ([Explicit], UnaryNest b') ExplicitApp Nothing Nothing body
375384
return (Empty, WithSrcE pos $ extendAppRight rhs' (ns lam))
376385
blockDecls (d:ds) = do
377386
d' <- decl PlainLet d

src/lib/Builder.hs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -602,22 +602,13 @@ buildBlock
602602
-> m n (Block r n)
603603
buildBlock = buildScoped
604604

605-
coreLamExpr :: EnvReader m => AppExplicitness
606-
-> Abs (Nest (WithExpl CBinder)) (PairE (EffectRow CoreIR) CBlock) n
607-
-> m n (CoreLamExpr n)
608-
coreLamExpr appExpl ab = liftEnvReaderM do
609-
refreshAbs ab \bs' (PairE effs' body') -> do
610-
EffTy _ resultTy <- blockEffTy body'
611-
let bs'' = fmapNest withoutExpl bs'
612-
return $ CoreLamExpr (CorePiType appExpl bs' (EffTy effs' resultTy)) (LamExpr bs'' body')
613-
614605
buildCoreLam
615606
:: ScopableBuilder CoreIR m
616607
=> CorePiType n
617608
-> (forall l. (Emits l, DExt n l) => [CAtomVar l] -> m l (CAtom l))
618609
-> m n (CoreLamExpr n)
619-
buildCoreLam piTy@(CorePiType _ bs _) cont = do
620-
lam <- buildLamExpr (EmptyAbs $ fmapNest withoutExpl bs) cont
610+
buildCoreLam piTy@(CorePiType _ _ bs _) cont = do
611+
lam <- buildLamExpr (EmptyAbs bs) cont
621612
return $ CoreLamExpr piTy lam
622613

623614
buildAbs
@@ -1083,7 +1074,7 @@ projectStructRef i x = do
10831074

10841075
getStructProjections :: EnvReader m => Int -> CType n -> m n [Projection]
10851076
getStructProjections i (NewtypeTyCon (UserADTType _ tyConName _)) = do
1086-
TyConDef _ _ ~(StructFields fields) <- lookupTyCon tyConName
1077+
TyConDef _ _ _ ~(StructFields fields) <- lookupTyCon tyConName
10871078
return case fields of
10881079
[_] | i == 0 -> [UnwrapNewtype]
10891080
| otherwise -> error "bad index"

src/lib/CheapReduction.hs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ cheapReduceDictExpr resultTy d = case d of
240240
cheapReduceE child >>= \case
241241
DictCon _ (InstanceDict instanceName args) -> dropSubst do
242242
args' <- mapM cheapReduceE args
243-
InstanceDef _ bs _ body <- lookupInstanceDef instanceName
243+
InstanceDef _ _ bs _ body <- lookupInstanceDef instanceName
244244
let InstanceBody superclasses _ = body
245245
applySubst (bs@@>(SubstVal <$> args')) (superclasses !! superclassIx)
246246
child' -> return $ DictCon resultTy $ SuperclassProj child' superclassIx
@@ -285,7 +285,7 @@ instance IRRep r => CheaplyReducibleE r (Expr r) (Atom r) where
285285
cheapReduceE dict >>= \case
286286
DictCon _ (InstanceDict instanceName args) -> dropSubst do
287287
args' <- mapM cheapReduceE args
288-
InstanceDef _ bs _ (InstanceBody _ methods) <- lookupInstanceDef instanceName
288+
InstanceDef _ _ bs _ (InstanceBody _ methods) <- lookupInstanceDef instanceName
289289
let method = methods !! i
290290
extendSubst (bs@@>(SubstVal <$> args')) do
291291
method' <- cheapReduceE method
@@ -466,7 +466,7 @@ wrapNewtypesData [] x = x
466466
wrapNewtypesData (c:cs) x = NewtypeCon c $ wrapNewtypesData cs x
467467

468468
instantiateTyConDef :: EnvReader m => TyConDef n -> TyConParams n -> m n (DataConDefs n)
469-
instantiateTyConDef (TyConDef _ bs conDefs) (TyConParams _ xs) = do
469+
instantiateTyConDef (TyConDef _ _ bs conDefs) (TyConParams _ xs) = do
470470
applySubst (bs @@> (SubstVal <$> xs)) conDefs
471471
{-# INLINE instantiateTyConDef #-}
472472

@@ -487,7 +487,7 @@ dataDefRep (StructFields fields) = case map snd fields of
487487

488488
makeStructRepVal :: (Fallible1 m, EnvReader m) => TyConName n -> [CAtom n] -> m n (CAtom n)
489489
makeStructRepVal tyConName args = do
490-
TyConDef _ _ (StructFields fields) <- lookupTyCon tyConName
490+
TyConDef _ _ _ (StructFields fields) <- lookupTyCon tyConName
491491
case fields of
492492
[_] -> case args of
493493
[arg] -> return arg
@@ -725,11 +725,9 @@ instance VisitGeneric CoreLamExpr CoreIR where
725725
visitGeneric (CoreLamExpr t lam) = CoreLamExpr <$> visitGeneric t <*> visitGeneric lam
726726

727727
instance VisitGeneric CorePiType CoreIR where
728-
visitGeneric (CorePiType app bsExpl effty) = do
729-
let (expls, bs) = unzipExpls bsExpl
728+
visitGeneric (CorePiType app expl bs effty) = do
730729
PiType bs' effty' <- visitGeneric $ PiType bs effty
731-
let bsExpl' = zipExpls expls bs'
732-
return $ CorePiType app bsExpl' effty'
730+
return $ CorePiType app expl bs' effty'
733731

734732
instance IRRep r => VisitGeneric (TabPiType r) r where
735733
visitGeneric (TabPiType d b eltTy) = do

src/lib/CheckType.hs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ instance IRRep r => HasType r (Type r) where
256256
TC tyCon -> typeCheckPrimTC tyCon
257257
DepPairTy ty -> getTypeE ty
258258
DictTy (DictType _ className params) -> do
259-
ClassDef _ _ _ paramBs _ _ <- renameM className >>= lookupClassDef
259+
ClassDef _ _ _ _ paramBs _ _ <- renameM className >>= lookupClassDef
260260
params' <- mapM renameM params
261261
checkArgTys paramBs params'
262262
return TyKind
@@ -293,9 +293,6 @@ instance (ToBinding ann c, Color c, CheckableE r ann) => CheckableB r (BinderP c
293293
extendRenamer (b@>binderName b') $
294294
cont b'
295295

296-
instance (BindsNames b, CheckableB r b) => CheckableB r (WithExpl b) where
297-
checkB (WithExpl expl b) cont = checkB b \b' -> cont (WithExpl expl b')
298-
299296
typeCheckExpr :: (Typer m r, IRRep r) => EffectRow r o -> Expr r i -> m i o (Type r o)
300297
typeCheckExpr effs expr = addContext ("Checking expr:\n" ++ pprint expr) case expr of
301298
App (EffTy _ reqTy) f xs -> do
@@ -318,7 +315,7 @@ typeCheckExpr effs expr = addContext ("Checking expr:\n" ++ pprint expr) case ex
318315
return resultTy'
319316
ApplyMethod (EffTy _ reqTy) dict i args -> do
320317
DictTy (DictType _ className params) <- getTypeE dict
321-
ClassDef _ _ _ paramBs classBs methodTys <- lookupClassDef className
318+
ClassDef _ _ _ _ paramBs classBs methodTys <- lookupClassDef className
322319
let methodTy = methodTys !! i
323320
superclassDicts <- getSuperclassDicts =<< renameM dict
324321
let subst = ( paramBs @@> map SubstVal params
@@ -342,8 +339,8 @@ dictExprType :: Typer m CoreIR => DictExpr i -> m i o (CType o)
342339
dictExprType e = case e of
343340
InstanceDict instanceName args -> do
344341
instanceName' <- renameM instanceName
345-
InstanceDef className bs params _ <- lookupInstanceDef instanceName'
346-
ClassDef sourceName _ _ _ _ _ <- lookupClassDef className
342+
InstanceDef className _ bs params _ <- lookupInstanceDef instanceName'
343+
ClassDef sourceName _ _ _ _ _ _ <- lookupClassDef className
347344
args' <- mapM renameM args
348345
checkArgTys bs args'
349346
ListE params' <- applySubst (bs@@>(SubstVal<$>args')) (ListE params)
@@ -353,7 +350,7 @@ dictExprType e = case e of
353350
checkApp Pure givenTy (toList args)
354351
SuperclassProj d i -> do
355352
DictTy (DictType _ className params) <- getTypeE d
356-
ClassDef _ _ _ bs superclasses _ <- lookupClassDef className
353+
ClassDef _ _ _ _ bs superclasses _ <- lookupClassDef className
357354
let scType = getSuperclassType REmpty superclasses i
358355
checkedApplyNaryAbs (Abs bs scType) params
359356
IxFin n -> do
@@ -370,7 +367,7 @@ instance IRRep r => HasType r (DepPairType r) where
370367
return TyKind
371368

372369
instance HasType CoreIR CorePiType where
373-
getTypeE (CorePiType _ bs (EffTy eff resultTy)) = do
370+
getTypeE (CorePiType _ _ bs (EffTy eff resultTy)) = do
374371
checkB bs \_ -> do
375372
void $ checkE eff
376373
resultTy|:TyKind
@@ -407,14 +404,14 @@ checkAgainstGiven givenTy computedTy = do
407404
return givenTy'
408405

409406
checkCoreLam :: Typer m CoreIR => CorePiType o -> LamExpr CoreIR i -> m i o ()
410-
checkCoreLam (CorePiType _ Empty (EffTy effs resultTy)) (LamExpr Empty body) = do
407+
checkCoreLam (CorePiType _ _ Empty (EffTy effs resultTy)) (LamExpr Empty body) = do
411408
resultTy' <- checkBlockWithEffs effs body
412409
checkTypesEq resultTy resultTy'
413-
checkCoreLam (CorePiType expl (Nest piB piBs) effTy) (LamExpr (Nest lamB lamBs) body) = do
410+
checkCoreLam (CorePiType expl (_:expls) (Nest piB piBs) effTy) (LamExpr (Nest lamB lamBs) body) = do
414411
argTy <- renameM $ binderType lamB
415412
checkTypesEq (binderType piB) argTy
416413
withFreshBinder (getNameHint lamB) argTy \b -> do
417-
piTy <- applyRename (piB@>binderName b) (CorePiType expl piBs effTy)
414+
piTy <- applyRename (piB@>binderName b) (CorePiType expl expls piBs effTy)
418415
extendRenamer (lamB@>binderName b) do
419416
checkCoreLam piTy (LamExpr lamBs body)
420417
checkCoreLam _ _ = throw TypeErr "zip error"
@@ -446,7 +443,7 @@ typeCheckNewtypeCon con x = case con of
446443
FinCon n -> n|:NatTy >> x|:NatTy >> renameM (Fin n)
447444
UserADTData _ d params -> do
448445
d' <- renameM d
449-
def@(TyConDef sn _ _) <- lookupTyCon d'
446+
def@(TyConDef sn _ _ _) <- lookupTyCon d'
450447
params' <- renameM params
451448
void $ checkedInstantiateTyConDef def params'
452449
return $ UserADTType sn d' params'
@@ -773,7 +770,7 @@ checkAlt resultTyReq bTyReq effs (Abs b body) = do
773770

774771
checkApp :: (Typer m r, IRRep r) => EffectRow r o -> Type r o -> [Atom r i] -> m i o (Type r o)
775772
checkApp allowedEffs fTy xs = case fTy of
776-
Pi (CorePiType _ bs effTy) -> do
773+
Pi (CorePiType _ _ bs effTy) -> do
777774
xs' <- mapM renameM xs
778775
checkArgTys bs xs'
779776
let subst = bs @@> fmap SubstVal xs'
@@ -929,7 +926,7 @@ checkUnOp op x = do
929926
checkedInstantiateTyConDef
930927
:: (EnvReader m, Fallible1 m)
931928
=> TyConDef n -> TyConParams n -> m n (DataConDefs n)
932-
checkedInstantiateTyConDef (TyConDef _ bs cons) (TyConParams _ xs) = do
929+
checkedInstantiateTyConDef (TyConDef _ _ bs cons) (TyConParams _ xs) = do
933930
checkedApplyNaryAbs (Abs bs cons) xs
934931

935932
checkedApplyNaryAbs
@@ -995,7 +992,7 @@ asFFIFunType ty = return do
995992
return (impTy, piTy)
996993

997994
checkFFIFunTypeM :: Fallible m => CorePiType n -> m IFunType
998-
checkFFIFunTypeM (CorePiType appExpl (Nest b bs) effTy) = do
995+
checkFFIFunTypeM (CorePiType appExpl (_:expls) (Nest b bs) effTy) = do
999996
argTy <- checkScalar $ binderType b
1000997
case bs of
1001998
Empty -> do
@@ -1006,7 +1003,7 @@ checkFFIFunTypeM (CorePiType appExpl (Nest b bs) effTy) = do
10061003
_ -> FFIMultiResultCC
10071004
return $ IFunType cc [argTy] resultTys
10081005
Nest b' rest -> do
1009-
let naryPiRest = CorePiType appExpl (Nest b' rest) effTy
1006+
let naryPiRest = CorePiType appExpl expls (Nest b' rest) effTy
10101007
IFunType cc argTys resultTys <- checkFFIFunTypeM naryPiRest
10111008
return $ IFunType cc (argTy:argTys) resultTys
10121009
checkFFIFunTypeM _ = error "expected at least one argument"

src/lib/Core.hs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,13 @@ instance BindsEnv EnvFrag where
218218
toEnvFrag frag = frag
219219
{-# INLINE toEnvFrag #-}
220220

221-
instance BindsEnv b => BindsEnv (WithExpl b) where
222-
toEnvFrag (WithExpl _ b) = toEnvFrag b
223-
{-# INLINE toEnvFrag #-}
224-
225-
instance BindsEnv RolePiBinder where
226-
toEnvFrag (RolePiBinder _ b) = toEnvFrag b
227-
{-# INLINE toEnvFrag #-}
228-
229221
instance BindsEnv (RecSubstFrag Binding) where
230222
toEnvFrag frag = EnvFrag frag
231223

224+
instance BindsEnv b => BindsEnv (WithAttrB a b) where
225+
toEnvFrag (WithAttrB _ b) = toEnvFrag b
226+
{-# INLINE toEnvFrag #-}
227+
232228
instance (BindsEnv b1, BindsEnv b2)
233229
=> (BindsEnv (PairB b1 b2)) where
234230
toEnvFrag (PairB b1 b2) = do

src/lib/Export.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,26 @@ liftExportSigM cont = do
100100

101101
corePiToExportSig :: CallingConvention
102102
-> CorePiType i -> ExportSigM CoreIR i o (ExportedSignature o)
103-
corePiToExportSig cc (CorePiType _ tbs (EffTy effs resultTy)) = do
103+
corePiToExportSig cc (CorePiType _ expls tbs (EffTy effs resultTy)) = do
104104
case effs of
105105
Pure -> return ()
106106
_ -> throw TypeErr "Only pure functions can be exported"
107-
goArgs cc Empty [] tbs resultTy
107+
goArgs cc Empty [] (zipAttrs expls tbs) resultTy
108108

109109
simpPiToExportSig :: CallingConvention
110110
-> PiType SimpIR i -> ExportSigM SimpIR i o (ExportedSignature o)
111111
simpPiToExportSig cc (PiType bs (EffTy effs resultTy)) = do
112112
case effs of
113113
Pure -> return ()
114114
_ -> throw TypeErr "Only pure functions can be exported"
115-
bs' <- return $ fmapNest (\b -> WithExpl Explicit b) bs
115+
bs' <- return $ fmapNest (\b -> WithAttrB Explicit b) bs
116116
goArgs cc Empty [] bs' resultTy
117117

118118
goArgs :: (IRRep r)
119119
=> CallingConvention
120120
-> Nest ExportArg o o'
121121
-> [CAtomName o']
122-
-> Nest (WithExpl (Binder r)) i i'
122+
-> Nest (WithAttrB Explicitness (Binder r)) i i'
123123
-> Type r i'
124124
-> ExportSigM r i o' (ExportedSignature o)
125125
goArgs cc argSig argVs piBs piRes = case piBs of
@@ -128,7 +128,7 @@ goArgs cc argSig argVs piBs piRes = case piBs of
128128
StandardCC -> (fromListE $ sink $ ListE argVs) ++ nestToList (sink . binderName) resSig
129129
XLACC -> []
130130
_ -> error $ "calling convention not supported: " ++ show cc
131-
Nest (WithExpl expl (b:>ty)) bs -> do
131+
Nest (WithAttrB expl (b:>ty)) bs -> do
132132
ety <- toExportType ty
133133
withFreshBinder (getNameHint b) ety \(v:>_) ->
134134
extendSubst (b @> Rename (binderName v)) $ do

0 commit comments

Comments
 (0)