toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

ToyLib.Parser

Description

StateT -based parser.

Synopsis

Documentation

runIO :: StateT ByteString IO a -> IO a #

Reads the whole stdin and runs the user program.

runFileIO :: StateT ByteString IO a -> String -> IO a #

Reads a file runs the user program.

Primitives

int' :: MonadState ByteString m => m Int #

Parses an Int.

int1' :: MonadState ByteString m => m Int #

Parses an Int and substracts one.

double' :: MonadState ByteString m => m Double #

Parsers an Int and converts it into a Double.

Tuples

Readers

line' :: MonadState ByteString m => m ByteString #

Reads one line from the state. FIXME: It ignores empty lines.

withLine' :: MonadState ByteString m => State ByteString a -> m a #

Reads one line from the state and runs a pure parser for it.

More

ints' :: MonadState ByteString m => m [Int] #

Reads one line an unboxed vector.

intsU' :: MonadState ByteString m => m (Vector Int) #

Reads one line an unboxed vector.

intsN' :: MonadState ByteString m => Int -> m (Vector Int) #

Reads n values as an unboxed vector.

digitsU' :: MonadState ByteString m => m (Vector Int) #

Reads one line as digits. TODO: one word might be better