Skip to content

Commit 8331d79

Browse files
author
Julien Debon
committedMay 3, 2020
Replace return with pure
1 parent 13cff95 commit 8331d79

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎posts/polysemy-first-example.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ myBusinessFunction m n = do
9494
" and " <> show n
9595
let result = m + n
9696
putStrLn $ "myBusinessFunction result is " <> show result
97-
return result
97+
pure result
9898
```
9999

100100
`IO` is too coarse, we want to replace its use with our shiny new effect. Fear not, my friend, this is as simple as:
@@ -106,7 +106,7 @@ myBusinessFunction m n = do
106106
" and " <> show n
107107
let result = m + n
108108
logInfo $ "myBusinessFunction result is " <> show result
109-
return result
109+
pure result
110110
```
111111

112112
The main changes are:

‎posts/polysemy-tests.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ myBusinessFunction m n = do
3434
" and " <> show n
3535
let result = m + n
3636
logInfo $ "myBusinessFunction result is " <> show result
37-
return result
37+
pure result
3838

3939
logToIO :: Member (Embed IO) r => Sem (Log ': r) a -> Sem r a
4040
logToIO = interpret (\(LogInfo stringToLog) -> embed $ putStrLn stringToLog)

0 commit comments

Comments
 (0)
Please sign in to comment.