Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
IO effects
Synopsis
- fromStdin :: Emitter IO Text
- toStdout :: Committer IO Text
- stdBox :: Text -> Box IO Text Text
- fromStdinN :: Int -> CoEmitter IO Text
- toStdoutN :: Int -> CoCommitter IO Text
- readStdin :: Read a => Emitter IO a
- showStdout :: Show a => Committer IO a
- refCommitter :: IO (Committer IO a, IO [a])
- refEmitter :: [a] -> IO (Emitter IO a)
- handleE :: (IsString a, Eq a) => (Handle -> IO a) -> Handle -> Emitter IO a
- handleC :: (Handle -> a -> IO ()) -> Handle -> Committer IO a
- fileE :: FilePath -> BufferMode -> IOMode -> (Handle -> Emitter IO a) -> CoEmitter IO a
- fileC :: FilePath -> IOMode -> BufferMode -> (Handle -> Committer IO a) -> CoCommitter IO a
- fileEText :: FilePath -> BufferMode -> CoEmitter IO Text
- fileEBS :: FilePath -> BufferMode -> CoEmitter IO ByteString
- fileCText :: FilePath -> BufferMode -> IOMode -> CoCommitter IO Text
- fileCBS :: FilePath -> BufferMode -> IOMode -> CoCommitter IO ByteString
- toLineBox :: Text -> Box IO ByteString ByteString -> CoBox IO Text Text
- fromLineBox :: Text -> Box IO Text Text -> Box IO ByteString ByteString
- logConsoleC :: Show a => String -> Committer IO a -> Committer IO a
- logConsoleE :: Show a => String -> Emitter IO a -> Emitter IO a
- pauser :: Emitter IO Bool -> Emitter IO a -> Emitter IO a
- changer :: Eq a => a -> Emitter IO a -> CoEmitter IO Bool
- quit :: Emitter IO Bool -> IO a -> IO (Either Bool a)
- restart :: Emitter IO Bool -> IO a -> IO (Either Bool a)
Documentation
toStdout :: Committer IO Text Source #
Commit to stdout
>>>
commit toStdout ("I'm committed!" :: Text)
I'm committed! True
fromStdinN :: Int -> CoEmitter IO Text Source #
Finite console emitter
λ> toListM <$|> fromStdinN 2 hello hello again ["hello","hello again"]
toStdoutN :: Int -> CoCommitter IO Text Source #
Finite console committer
>>>
glue <$> contramap (pack . show) <$> (toStdoutN 2) <*|> qList [1..3]
1 2
readStdin :: Read a => Emitter IO a Source #
Read from console, throwing away read errors
λ> glueN 2 showStdout (readStdin :: Emitter IO Int) 1 1 hippo 2 2
showStdout :: Show a => Committer IO a Source #
Show to stdout
>>>
glue showStdout <$|> qList [1..3]
1 2 3
refCommitter :: IO (Committer IO a, IO [a]) Source #
Commit to an IORef
>>>
(c1,l1) <- refCommitter :: IO (Committer IO Int, IO [Int])
>>>
glue c1 <$|> qList [1..3]
>>>
l1
[1,2,3]
refEmitter :: [a] -> IO (Emitter IO a) Source #
Emit from a list IORef
>>>
e <- refEmitter [1..3]
>>>
toListM e
[1,2,3]
handleE :: (IsString a, Eq a) => (Handle -> IO a) -> Handle -> Emitter IO a Source #
Emits lines of Text from a handle.
handleC :: (Handle -> a -> IO ()) -> Handle -> Committer IO a Source #
Commit lines of Text to a handle.
fileE :: FilePath -> BufferMode -> IOMode -> (Handle -> Emitter IO a) -> CoEmitter IO a Source #
Emit from a file.
fileC :: FilePath -> IOMode -> BufferMode -> (Handle -> Committer IO a) -> CoCommitter IO a Source #
Commit to a file.
fileEBS :: FilePath -> BufferMode -> CoEmitter IO ByteString Source #
Emit lines of ByteString from a file.
fileCText :: FilePath -> BufferMode -> IOMode -> CoCommitter IO Text Source #
Commit Text to a file, as a line.
fileCBS :: FilePath -> BufferMode -> IOMode -> CoCommitter IO ByteString Source #
Commit ByteString to a file, as a line.
toLineBox :: Text -> Box IO ByteString ByteString -> CoBox IO Text Text Source #
Convert a Box
from ByteString to lines of Text.
fromLineBox :: Text -> Box IO Text Text -> Box IO ByteString ByteString Source #
Convert a Box
from lines of Text to ByteStrings.
logConsoleC :: Show a => String -> Committer IO a -> Committer IO a Source #
simple console logger for rough testing
logConsoleE :: Show a => String -> Emitter IO a -> Emitter IO a Source #
simple console logger for rough testing
pauser :: Emitter IO Bool -> Emitter IO a -> Emitter IO a Source #
Pause an emitter based on a Bool emitter
changer :: Eq a => a -> Emitter IO a -> CoEmitter IO Bool Source #
Create an emitter that indicates when another emitter has changed.