@@ -58,6 +58,7 @@ type LayoutLambdaData
58
58
, name :: String
59
59
}
60
60
, scope :: ScopeId
61
+ , isRoot :: Boolean
61
62
)
62
63
63
64
-- | The base functor for scoped layouts.
@@ -155,6 +156,7 @@ addIndices =
155
156
position <- nearFunction $ ask <#> _.near >>= placeExpression except constraint
156
157
pure $ call { position } function argument
157
158
Lambda vars (Tuple groupedBody layoutBody) -> do
159
+ currentScope <- ask <#> _.currentScope
158
160
scope <- newScope
159
161
initialState <- get
160
162
let
@@ -178,7 +180,7 @@ addIndices =
178
180
-- This holds all the variables referenced inside the body of the lambda
179
181
inBody <- Set .fromFoldable <$> for referenced getVarPosition
180
182
position <- ask <#> _.near >>= placeExpression inBody Everywhere
181
- pure $ lambda { position, args, scope } body
183
+ pure $ lambda { position, args, scope, isRoot: currentScope == Root } body
182
184
where
183
185
newList = List .range 0 (varCount - 1 ) <#> \index -> varCount - index - 1
184
186
@@ -386,11 +388,11 @@ unscopeLayout layout = layout >>= cata algebra
386
388
argument' <- argument
387
389
position' <- unscopePosition position
388
390
in call position' function' argument'
389
- Lambda { position, scope, args } body -> ado
391
+ Lambda { position, scope, args, isRoot } body -> ado
390
392
position' <- unscopePosition position
391
393
body' <- body
392
394
args' <- for args (_.position >>> unscopePosition)
393
- in lambda { position: position', args: args', isRoot: scope == Root } body'
395
+ in lambda { position: position', args: args', isRoot } body'
394
396
395
397
-- | Typeclass instances
396
398
derive instance eqScopeId :: Eq ScopeId
0 commit comments