4 ms·
When I write this: someTransaction = do incrementCounter writeFile "foo.txt" "bar" decrementCounter I get this: src/Lib.hs:11:5: erro
by mrkeen 3y ago
When I write this:
someTransaction = do
incrementCounter
writeFile "foo.txt" "bar"
decrementCounter
I get this:
src/Lib.hs:11:5: error:
• Couldn't match type ‘IO’ with ‘STM’
Expected: STM ()
Actual: IO ()
• In a stmt of a 'do' block: writeFile "foo.txt" "bar"
In the expression:
do incrementCounter
writeFile "foo.txt" "bar"
decrementCounter
In an equation for ‘someTransaction’:
someTransaction
= do incrementCounter
writeFile "foo.txt" "bar"
decrementCounter
|
11 | writeFile "foo.txt" "bar"
| ^^^^^^^^^^^^^^^^^^^^^^^^^