This module provides a small number of tricky functions used to implement (de)serializers. User code should not need to import this library.
- ext2Q :: (Data d, Typeable2 t) => (d -> q) -> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q) -> d -> q
- gSerial :: (Data d, MonadWStream m c) => (forall a. Data a => a -> m ()) -> d -> (Constr, m ())
- gDeser :: (Data d, Monad m) => (DataType -> m Constr) -> (forall a. Data a => m a) -> m d
- (=>>) :: Monad m => m a -> m b -> m a
- (>>$) :: Monad m => m a -> (a -> b) -> m b
- unfoldM :: Monad m => m (Maybe a) -> m [a]
- match :: MonadRStream m Char => Char -> m ()
- manySat :: MonadRStream m a => (a -> Bool) -> m [a]
- matchs :: MonadRStream m Char => [Char] -> m ()
- getv_t :: MonadRStream m a => m b -> m a
- getcase :: (Eq a, MonadRStream m a) => (a -> m b) -> [(a, m b)] -> m b
- peekcase :: (Eq a, MonadRStream m a) => m b -> (a -> m b) -> [(a, m b)] -> m b
- matchws :: MonadRStream m Char => Char -> m ()
- space :: MonadRStream m Char => m ()
- readM :: (Monad m, Read a, Typeable a) => String -> m a
- fromMaybeM :: Monad m => String -> Maybe a -> m a
- escape :: Char -> [Char] -> [Char] -> String -> String
- unescape :: Char -> [Char] -> [Char] -> String -> Maybe String
- mkescape :: Char -> [Char] -> [Char] -> (String -> String, String -> Maybe String)
- breakr :: (a -> Bool) -> [a] -> ([a], [a])
Documentation
ext2Q :: (Data d, Typeable2 t) => (d -> q) -> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q) -> d -> qSource
Like ext1Q
, except for a binary type constructor
gSerial :: (Data d, MonadWStream m c) => (forall a. Data a => a -> m ()) -> d -> (Constr, m ())Source
Run a monadic action over each element in an existing data object; also
return the Constr
.
gDeser :: (Data d, Monad m) => (DataType -> m Constr) -> (forall a. Data a => m a) -> m dSource
Build an object using monadic actions to read the Constr
and all children.
(=>>) :: Monad m => m a -> m b -> m aSource
Execute two monadic actions in sequence, returning the value of the first. This is mainly useful with parser combinators.
(>>$) :: Monad m => m a -> (a -> b) -> m bSource
Execute a monadic action, piping the result through a pure function. This
is the same as flip liftM, and has the same fixity as >>=
.
match :: MonadRStream m Char => Char -> m ()Source
Parse a designated character, error on a different character.
manySat :: MonadRStream m a => (a -> Bool) -> m [a]Source
Parse and return one or more characters parsed using a recognition function.
getv_t :: MonadRStream m a => m b -> m aSource
Get one character, then run a parser (e.g. space).
getcase :: (Eq a, MonadRStream m a) => (a -> m b) -> [(a, m b)] -> m bSource
Get one character and process it using a list of actions.
peekcase :: (Eq a, MonadRStream m a) => m b -> (a -> m b) -> [(a, m b)] -> m bSource
Peek at one character and process it using a list of actions.
matchws :: MonadRStream m Char => Char -> m ()Source
Parse a designated character, then any amount of whitespace.
space :: MonadRStream m Char => m ()Source
Parse as many spaces as possible.
fromMaybeM :: Monad m => String -> Maybe a -> m aSource
Convert a Maybe
object into any monad, using the imbedding defined by
fail and return.