MyNixOS website logo
Description

Source/Sink/Transform: An alternative to lazy IO and iteratees.

Haskell library for Sources, Sinks and Transformers. The data is pushed from the source through the transfomers into the sink. The sink or a transfomer can decide at any time to end the transfer (see Iteratees). The transformers are very reusable since they can not depend on side effects, so they can be used with files as well as with simple lists.

Allows you to build pipelines such as:

>>> listSource [1..10] $$ T.map(+1) =$= T.buffer 3 0 (+) =$ listSink
[9,18,27,11]

its possible to mix various type of sources and sinks, such as in:

>>> fileSourceLine \"myfile.txt\" $$ T.drop 1 =$= T.map (++ "!") =$ listSink
[\"Hello Mario!\", \"How're you doing?!\"]

For more documentation see https://github.com/msiegenthaler/SouSiT.

SouSiT

Haskell library for Sources, Sinks and Transformers. The data is pushed from the source through the transfomers into the sink. The sink or a transfomer can decide at any time to end the transfer (see Iteratees). The transformers are very reusable since they can not depend on side effects, so they can be used with files as well as with simple lists.

Allows you to build pipelines such as:

ghci> listSource [1..10] $$ T.map(+1) =$= T.buffer 3 0 (+) =$ listSink
[9,18,27,11]

its possible to mix various type of sources and sinks, such as in:

ghci> fileSourceLine "myfile.txt" $$ T.drop 1 =$= T.map (++ "!") =$ listSink
["Hello Mario!", "How're you doing?!"]

Available Sources

  • List
  • Handle (IO)
  • File

More types of sources can be added by users of the library. Consider using actionSource or bracketActionSource as a help if you do so.

Available Sinks

  • List
  • Handle (IO)
  • File
  • monadic sink

More types of sinks can be added by users of the library. Consider using either actionSink or the monadic sink interface if implementing your own sinks.

Monadic Sink

You can write sink in monad style

Example that reads the first input, then skips the next three values and then reads two values and terminates. It outputs a tuple with the three values read.

mySink = do v1 <- input
            skip 3
            v2 <- input
            v3 <- input
            return (v1, v2, v3)
Metadata

Version

0.4

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows