git.iko.soy/typeable/pandoc
on master help sign in
T.P.Shared: Remove ToString, ToText typeclasses [API change].

T.P.Parsing: revise type of readWithM so that it takes a Text rather than a polymorphic ToText value. These typeclasses were there to ease the transition from String to Text. They are no longer needed, and they may clash with more useful versions under the same name. This will require a bump to 2.13.

commit005f0fbcd558636f0d5db1203427a4d7b341f36e authorJohn MacFarlane <jgm@berkeley.edu> dateFri 19 Mar 2021, 12:34 (6 years ago) parent425c2e4
2 files changed+4−24
src/Text/Pandoc/Parsing.hs+4−4 src/Text/Pandoc/Shared.hs−20
src/Text/Pandoc/Parsing.hs+4−4
@@ -1128,13 +1128,13 @@ gridTableFooter = optional blanklines
11281128---
11291129
11301130-- | Removes the ParsecT layer from the monad transformer stack
1131−readWithM :: (Stream s m Char, ToText s)
1132− => ParserT s st m a -- ^ parser
1131+readWithM :: Monad m
1132+ => ParserT Text st m a -- ^ parser
11331133 -> st -- ^ initial state
1134− -> s -- ^ input
1134+ -> Text -- ^ input
11351135 -> m (Either PandocError a)
11361136readWithM parser state input =
1137− mapLeft (PandocParsecError $ toText input) `liftM` runParserT parser state "source" input
1137+ mapLeft (PandocParsecError input) <$> runParserT parser state "source" input
11381138
11391139-- | Parse a string with a given parser and state
11401140readWith :: Parser Text st a
src/Text/Pandoc/Shared.hs−20
@@ -25,8 +25,6 @@ module Text.Pandoc.Shared (
2525 ordNub,
2626 findM,
2727 -- * Text processing
28− ToString (..),
29− ToText (..),
3028 tshow,
3129 backslashEscapes,
3230 escapeStringUsing,
@@ -183,24 +181,6 @@ findM p = foldr go (pure Nothing)
183181-- Text processing
184182--
185183
186−class ToString a where
187− toString :: a -> String
188−
189−instance ToString String where
190− toString = id
191−
192−instance ToString T.Text where
193− toString = T.unpack
194−
195−class ToText a where
196− toText :: a -> T.Text
197−
198−instance ToText String where
199− toText = T.pack
200−
201−instance ToText T.Text where
202− toText = id
203−
204184tshow :: Show a => a -> T.Text
205185tshow = T.pack . show
206186