knob: Memory-backed handles

[ library, mit, system ] [ Propose Tags ] [ Report a vulnerability ]

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)

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.2, 0.2.1, 0.2.2
Dependencies base (>=4.15 && <5), bytestring (>=0.9 && <0.13), transformers (>=0.2 && <0.7) [details]
Tested with ghc ==9.0.2, ghc ==9.2.1
License MIT
Author John Millikin <jmillikin@gmail.com>
Maintainer Naïm Favier <n@monade.li>
Revised Revision 1 made by ncfavier at 2024-02-01T15:39:30Z
Category System
Home page https://github.com/ncfavier/knob
Bug tracker https://github.com/ncfavier/knob/issues
Source repo head: git clone https://github.com/ncfavier/knob
Uploaded by ncfavier at 2023-02-10T12:46:12Z
Distributions Arch:0.2.2, Debian:0.1.1, LTSHaskell:0.2.2, NixOS:0.2.2, Stackage:0.2.2
Reverse Dependencies 3 direct, 4 indirect [details]
Downloads 7264 total (34 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-02-10 [all 1 reports]