homepage: https://github.com/dcastro/safe-buffer-monad#readme
changelog-type: ''
hash: 4807ac725dc6547a6c64a994d7bc68f7d427627956b361e1298be1b283ed50fe
test-bench-deps:
  unliftio: -any
  stm: ! '>=2.0 && <3.0'
  base: ! '>=4.7 && <5'
  hspec: -any
  safe-exceptions: ! '>=0.1 && <1.0'
  mtl: ! '>=2.0 && <3.0'
  safe-buffer-monad: -any
maintainer: dc@diogocastro.com
synopsis: A monadic buffer resilient to exceptions
changelog: ''
basic-deps:
  stm: ! '>=2.0 && <3.0'
  base: ! '>=4.7 && <5'
  safe-exceptions: ! '>=0.1 && <1.0'
  mtl: ! '>=2.0 && <3.0'
all-versions:
- '0.1.0'
author: Diogo Castro
latest: '0.1.0'
description-type: markdown
description: ! "# safe-buffer-monad\n\nA monadic buffer resilient to exceptions.\n\nThe
  `SafeBufferMonad` typeclass models a buffer that you can write things to. If an
  exception is thrown,\nyou'll still be able to proccess the contents of the buffer
  up to the point where the computation was interrupted.\n\n```haskell\nclass Monad
  m => SafeBufferMonad s m | m -> s where\n  readBuffer   :: m s\n  writeBuffer  ::
  s -> m ()\n  clearBuffer  :: m s\n  modifyBuffer :: (s -> s) -> m ()\n```\n\nThe
  buffer can be run using one of these 6 functions:\n\n* `runBuffer` / `runBufferConcurrently`\n*
  `tryRunBuffer` / `tryRunBufferConcurrently`\n* `execBuffer` / `execBufferConcurrently`\n\n```haskell\n{-#
  LANGUAGE FlexibleContexts #-}\n\nimport SafeBuffer\nimport Data.List (intercalate)\n\ngo
  :: (SafeBufferMonad [String] m, MonadIO m) => m String\ngo = do\n  writeBuffer [\"line
  1\"]\n  writeBuffer [\"line 2\"]\n  liftIO $ putStrLn \"brace for impact!\"\n  liftIO
  $ throwIO $ userError \"boom\"\n  writeBuffer [\"line 3\"]\n  pure \"done!\"\n\nmain
  = runBuffer (appendFile \"log.txt\" . intercalate \"\\n\") go\n```\n\n```plain\nλ>
  main\nbrace for impact!\n*** Exception: user error (boom)\n\nλ> :! tail log.txt\nline
  1\nline 2\n```\n"
license-name: BSD3

Update from Hackage at 2018-06-17T19:22:03Z
Update from Hackage at 2018-06-17T19:22:03Z
