Skip to content
This repository was archived by the owner on Jun 18, 2023. It is now read-only.

Commit 9b45b8e

Browse files
committed
fix(client): removed unnecessary background for the root lambda
1 parent dfacec6 commit 9b45b8e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/Layout.purs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type LayoutLambdaData
5858
, name :: String
5959
}
6060
, scope :: ScopeId
61+
, isRoot :: Boolean
6162
)
6263

6364
-- | The base functor for scoped layouts.
@@ -155,6 +156,7 @@ addIndices =
155156
position <- nearFunction $ ask <#> _.near >>= placeExpression except constraint
156157
pure $ call { position } function argument
157158
Lambda vars (Tuple groupedBody layoutBody) -> do
159+
currentScope <- ask <#> _.currentScope
158160
scope <- newScope
159161
initialState <- get
160162
let
@@ -178,7 +180,7 @@ addIndices =
178180
-- This holds all the variables referenced inside the body of the lambda
179181
inBody <- Set.fromFoldable <$> for referenced getVarPosition
180182
position <- ask <#> _.near >>= placeExpression inBody Everywhere
181-
pure $ lambda { position, args, scope } body
183+
pure $ lambda { position, args, scope, isRoot: currentScope == Root } body
182184
where
183185
newList = List.range 0 (varCount - 1) <#> \index -> varCount - index - 1
184186

@@ -386,11 +388,11 @@ unscopeLayout layout = layout >>= cata algebra
386388
argument' <- argument
387389
position' <- unscopePosition position
388390
in call position' function' argument'
389-
Lambda { position, scope, args } body -> ado
391+
Lambda { position, scope, args, isRoot } body -> ado
390392
position' <- unscopePosition position
391393
body' <- body
392394
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'
394396

395397
-- | Typeclass instances
396398
derive instance eqScopeId :: Eq ScopeId

0 commit comments

Comments
 (0)