-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bidirectional (de-)serialization -- -- Roundtrip allows the definition of bidirectional (de-)serialization -- specifications. This package provides concrete implementations of -- these specifications for parsing/pretty-printing strings. -- -- See the roundtrip package for more details. @package roundtrip-string @version 0.1.0.0 module Text.Roundtrip.Printer newtype Printer m r a Printer :: (a -> m (Maybe r)) -> Printer m r a unPrinter :: Printer m r a -> a -> m (Maybe r) printerApply :: Monad m => Iso a b -> Printer m r a -> Printer m r b printerConcat :: (Monoid r, Monad m) => Printer m r a -> Printer m r b -> Printer m r (a, b) printerAlternative :: Monad m => Printer m r a -> Printer m r a -> Printer m r a printerEmpty :: Monad m => Printer m r a printerPure :: (Monad m, Monoid r, Eq a) => a -> Printer m r a runPrinter :: Printer Identity r a -> a -> Maybe r runStringPrinter :: Printer Identity String a -> a -> Maybe String instance Monad m => StringSyntax (Printer m String) instance (Monad m, Monoid r) => Syntax (Printer m r) instance Monad m => Alternative (Printer m r) instance (Monad m, Monoid r) => ProductFunctor (Printer m r) instance Monad m => IsoFunctor (Printer m r) module Text.Roundtrip.Parser -- | Create a new SourcePos with the given source name, line number -- and column number. newPos :: SourceName -> Line -> Column -> SourcePos -- | Create a new SourcePos with the given source name, and line -- number and column number set to 1, the upper left. initialPos :: SourceName -> SourcePos type PParser s u m = ParsecT s u m parsecApply :: Iso a b -> PParser s u m a -> PParser s u m b parsecConcat :: PParser s u m a -> PParser s u m b -> PParser s u m (a, b) parsecAlternative1Lookahead :: PParser s u m a -> PParser s u m a -> PParser s u m a parsecAlternativeInfLookahead :: PParser s u m a -> PParser s u m a -> PParser s u m a parsecEmpty :: PParser s u m a parsecPure :: a -> PParser s u m a runStringParser :: Stream s Identity Char => PParser s () Identity a -> SourceName -> s -> Either ParseError a -- | The most general way to run a parser over the Identity monad. -- runParser p state filePath input runs parser p on -- the input list of tokens input, obtained from source -- filePath with the initial user state st. The -- filePath is only used in error messages and may be the empty -- string. Returns either a ParseError (Left) or a value of -- type a (Right). -- --
-- parseFromFile p fname
-- = do{ input <- readFile fname
-- ; return (runParser p () fname input)
-- }
--
runParser :: Stream s Identity t => Parsec s u a -> u -> SourceName -> s -> Either ParseError a
mkParseError :: SourcePos -> String -> ParseError
instance (Monad m, Stream s m Char) => StringSyntax (PParser s u m)
instance Monad m => Syntax (PParser s u m)
instance Monad m => Alternative (PParser s u m)
instance Monad m => ProductFunctor (PParser s u m)
instance Monad m => IsoFunctor (PParser s u m)