Try and fix stuff by generalizing a signature to ease debugging and add parenthesis which I think should have been here all along

This commit is contained in:
Tissevert 2019-09-27 18:38:03 +02:00
parent 3b59fd0c61
commit 32efdcdd6b

View file

@ -1,8 +1,8 @@
{-# LANGUAGE OverloadedStrings #-}
module PDF.Text (
module PDF.Text {-(
PageContents(..)
, pageContents
) where
)-} where
import Control.Applicative ((<|>))
import Control.Monad (foldM, join)
@ -61,7 +61,7 @@ textOperator Tf = (,) Tf <$> sequence [Typed . NameObject <$> name, argument] <*
textOperator Tr = (,) Tr <$> count 1 argument <* string "Tr"
textOperator Ts = (,) Ts <$> count 1 argument <* string "Ts"
a :: (Bounded o, Enum o) => (o -> ParserWithFont (Call o)) -> ParserWithFont (Call o)
a :: (Bounded o, Enum o, MonadParser m) => (o -> m (Call o)) -> m (Call o)
a parserGenerator = choice $ parserGenerator <$> [minBound .. maxBound]
argument :: MonadParser m => m Argument
@ -84,7 +84,7 @@ graphicState :: ParserWithFont [ByteString]
graphicState =
string "q" *> blank *> insideQ <* string "Q"
where
insideQ = join <$> (command <|> page `sepBy` blank )
insideQ = join <$> ((command <|> page) `sepBy` blank )
command = a stateOperator *> return []
text :: ParserWithFont [ByteString]