@hackage knob0.2.2
Memory-backed handles
Categories
License
MIT
Maintainer
Naïm Favier <n@monade.li>
Links
Versions
Installation
Tested Compilers
Dependencies (3)
- base >=4.15 && <5
- bytestring >=0.9 && <0.13
- transformers >=0.2 && <0.7 Show all…
Dependents (8)
@hackage/gigaparsec, @hackage/typed-protocols-doc, @hackage/acme-everything, @hackage/rdf4h, @hackage/simpleirc, @hackage/haskell-tools-cli, Show all…
Create memory-backed Handles, referencing virtual files. This is
mostly useful for testing Handle-based APIs without having to
interact with the filesystem.
import Data.ByteString (pack)
import Data.Knob
import System.IO
main = do
knob <- newKnob (pack [])
h <- newFileHandle knob "test.txt" WriteMode
hPutStrLn h "Hello world!"
hClose h
bytes <- Data.Knob.getContents knob
putStrLn ("Wrote bytes: " ++ show bytes)