Skip to content

Commit dc5efdd

Browse files
committed
Merge pull request #11 from ethul/topic/goEff
Topic/go eff
2 parents 5c328ad + fdd4bdd commit dc5efdd

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

examples/Free.purs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ instance teletypeFFunctor :: Functor TeletypeF where
1212

1313
type Teletype = Free TeletypeF
1414

15-
putStrLn :: String -> Teletype {}
16-
putStrLn s = liftF $ PutStrLn s {}
15+
putStrLn :: String -> Teletype Unit
16+
putStrLn s = liftF $ PutStrLn s unit
1717

1818
getLine :: Teletype String
1919
getLine = liftF $ GetLine (\a -> a)
@@ -29,5 +29,8 @@ echo = do
2929
a <- getLine
3030
putStrLn a
3131
putStrLn "Finished"
32+
return $ a ++ a
3233

33-
main = run $ echo
34+
main = do
35+
a <- run $ echo
36+
trace a

src/Control/Monad/Free.purs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ foreign import goEffImpl
129129
\ return function(){\
130130
\ while (true) {\
131131
\ var r = resume(value);\
132-
\ if (isRight(r)) {\
133-
\ var x = fromRight(r);\
134-
\ return function() { return x; };\
135-
\ }\
132+
\ if (isRight(r)) return fromRight(r);\
136133
\ value = fn(fromLeft(r))();\
137134
\ }\
138135
\ };\

0 commit comments

Comments
 (0)