toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

ToyLib.Parser.Grid

Description

Grid parsers.

Synopsis

Documentation

getMat' :: MonadState ByteString m => Int -> Int -> m (IxVector (Int, Int) (Vector Int)) #

\(O(HW)\) Reads next h * w elements as matrix of type a.

Example

Input:

1 2 3
4 5 6

Parsed result:

1 2 3
4 5 6

getGrid' :: MonadState ByteString m => Int -> Int -> m (IxUVector (Int, Int) Char) #

\(O(HW)\) Reads next h * w elements as a char-based grid.

Example

Input:

abc
def

Parsed result:

a b c
d e f

getDiagMat' :: (PrimMonad m, MonadState ByteString m) => Int -> m (IxUVector (Int, Int) Int) #

\(O(HW)\) Gets diagnoal matrix input.

Example

Input:

4 8 5
6 8
3

Parsed result:

0 4 8 5
4 0 6 8
8 6 0 3
5 8 3 0