Provides the higher order IO function interact for prototyping command line interfaces.
A small tutorial package for Haskell refugees.
Interact takes a function of type Fn(String) -> String, runs it on stdin
and prints the result to stdout.
Examples:
cat
use interact;
use identity;
$ cat cat.rs | cargo run --bin cat
use interakt::interact;
use std::convert::identity;
fn main() -> std::io::Result<()> { interact(identity) }
wc
# use interact;
$ cat cat.rs | cargo run --bin wc
109
wc -l
# use interact;
$ cat cat.rs | cargo run --bin wcl
4
rev
# use interact;
$ cat cat.rs | cargo run --bin rev
;tcaretni::tkaretni esu
;ytitnedi::trevnoc::dts esu
} )ytitnedi(tcaretni { >)(<tluseR::oi::dts >- )(niam nf