-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix effect loop codegen in branches (#97)
* Fix effect loop codegen in branches. Fixes #96. * Fix issue with dropped statements. * Commit snapshot
- Loading branch information
1 parent
9de6bd8
commit 38aa921
Showing
4 changed files
with
83 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
backend-es/test/snapshots-out/Snapshot.EffectLoopCaseRegression.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as $runtime from "../runtime.js"; | ||
import * as Effect$dConsole from "../Effect.Console/index.js"; | ||
const test = eff => () => { | ||
const res = eff(); | ||
if (res.tag === "Nothing") { return; } | ||
if (res.tag === "Just") { | ||
for (const a of res._1) { | ||
Effect$dConsole.log(a)(); | ||
} | ||
return; | ||
} | ||
$runtime.fail(); | ||
}; | ||
export {test}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
const test = x => { | ||
const $0 = x ? (a => () => a.push(1)) : a => () => a.unshift(2); | ||
return (() => { | ||
const arr = []; | ||
$0(arr)(); | ||
return arr; | ||
})(); | ||
const arr = []; | ||
$0(arr)(); | ||
return arr; | ||
}; | ||
export {test}; |
17 changes: 17 additions & 0 deletions
17
backend-es/test/snapshots/Snapshot.EffectLoopCaseRegression.purs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Snapshot.EffectLoopCaseRegression where | ||
|
||
import Prelude | ||
|
||
import Data.Maybe (Maybe(..)) | ||
import Effect (Effect, foreachE) | ||
import Effect.Console as Console | ||
|
||
test :: Effect (Maybe (Array String)) -> Effect Unit | ||
test eff = do | ||
res <- eff | ||
case res of | ||
Nothing -> | ||
pure unit | ||
Just as -> | ||
foreachE as \a -> | ||
Console.log a |