interact -package:yi-core

interact f takes the entire input from stdin and applies f to it. The resulting string is written to the stdout device. Note that this operation is lazy, which allows to produce output even before all input has been consumed. This operation may fail with the same errors as getContents and putStr.

Examples

>>> interact (\str -> str ++ str)
> hi :)
hi :)
> ^D
hi :)
>>> interact (const ":D")
:D
>>> interact (show . words)
> hello world!
> I hope you have a great day
> ^D
["hello","world!","I","hope","you","have","a","great","day"]
The interact function takes a function of type ByteString -> ByteString as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
The interact function takes a function of type Text -> Text as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
The interact function takes a function of type Text -> Text as its argument. The entire input from the standard input device is passed (lazily) to this function as its argument, and the resulting string is output on the standard output device.
The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
Lifted interact
Lifted interact
Takes a function of type 'LText -> LText' and passes all input on stdin to it, then prints result to stdout Uses lazy IO Uses system locale settings
A synonym for hPut, for compatibility hPutStr :: Handle -> ByteStream IO r -> IO r hPutStr = hPut
  • - | Write a ByteStream to stdout putStr :: ByteStream IO r -> IO r putStr = hPut IO.stdout
The interact function takes a function of type ByteStream -> ByteStream as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
interact morph = stdout (morph stdin)
Interact with stdin and stdout by using a function to transform input to output. May be lazy. See interact for more.
Take a function of type Text -> Text as its argument The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
Not on Stackage, so not searched. instantly create REPL from any function
Display mode is for drawing a static picture.
This is a library of interactive processes combinators, usable to define extensible keymaps. (Inspired by the Parsec library, written by Koen Claessen) The processes are:
  • composable: in parallel using <|>, in sequence using monadic bind.
  • extensible: it is always possible to override a behaviour by combination of adjustPriority and <|>. (See also <|| for a convenient combination of the two.)
  • monadic: sequencing is done via monadic bind. (leveraging the whole battery of monadic tools that Haskell provides)
The processes can parse input, and write output that depends on it. The semantics are quite obvious; only disjunction deserve a bit more explanation: in p = (a <|> b), what happens if a and b recognize the same input (prefix), but produce conflicting output?
  • if the output is the same (as by the Eq class), then the processes (prefixes) are "merged"
  • if a Write is more prioritized than the other, the one with low priority will be discarded
  • otherwise, the output will be delayed until one of the branches can be discarded.
  • if there is no way to disambiguate, then no output will be generated anymore. This situation can be detected by using possibleActions however.
Built-in "bad" SrcLoc values for particular locations