Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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"
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: