diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-10-19 12:09:44 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-10-19 12:09:44 -0700 |
| commit | fe137c9d403b78eb508c6514c9234eb8fe4d77d1 (patch) | |
| tree | 677bd2a0828727e15f758823278f73e887290655 /src | |
| parent | 2e1f424daa859b163d85ac1452b1478af618169b (diff) | |
T.P.Shared: remove `mapLeft` [API change].
This is just a synonym for Bifunctor.first.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Parsing/General.hs | 6 | ||||
| -rw-r--r-- | src/Text/Pandoc/Shared.hs | 10 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Parsing/General.hs b/src/Text/Pandoc/Parsing/General.hs index bd1a16e8e..f09175cd4 100644 --- a/src/Text/Pandoc/Parsing/General.hs +++ b/src/Text/Pandoc/Parsing/General.hs @@ -97,7 +97,7 @@ import Text.Pandoc.Options ( extensionEnabled , Extension(Ext_auto_identifiers, Ext_ascii_identifiers) , ReaderOptions(readerTabStop, readerExtensions) ) -import Text.Pandoc.Shared (mapLeft, tshow, uniqueIdent) +import Text.Pandoc.Shared (tshow, uniqueIdent) import Text.Pandoc.URI (schemes, escapeURI) import Text.Pandoc.Sources import Text.Pandoc.XML (fromEntities) @@ -145,6 +145,7 @@ import qualified Data.Set as Set import qualified Data.Text as T import qualified Text.Pandoc.Builder as B import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn) +import qualified Data.Bifunctor as Bifunctor -- | Remove whitespace from start and end; just like @'trimInlines'@, -- but lifted into the 'Future' type. @@ -630,11 +631,12 @@ readWithM :: (Monad m, ToSources t) -> t -- ^ input -> m (Either PandocError a) readWithM parser state input = - mapLeft (fromParsecError sources) + Bifunctor.first (fromParsecError sources) <$> runParserT parser state (initialSourceName sources) sources where sources = toSources input + -- | Parse a string with a given parser and state readWith :: ToSources t => Parsec Sources st a diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 75d26816f..dbe547325 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -74,8 +74,6 @@ module Text.Pandoc.Shared ( makeCanonical, collapseFilePath, filteredFilesFromArchive, - -- * Error handling - mapLeft, -- * for squashing blocks blocksToInlines, blocksToInlines', @@ -91,7 +89,6 @@ import qualified Control.Exception as E import Control.Monad (MonadPlus (..), msum, unless) import qualified Control.Monad.State.Strict as S import qualified Data.ByteString.Lazy as BL -import qualified Data.Bifunctor as Bifunctor import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum, generalCategory, GeneralCategory(NonSpacingMark, SpacingCombiningMark, EnclosingMark, ConnectorPunctuation)) @@ -796,13 +793,6 @@ makeCanonical = Posix.joinPath . transformPathParts . splitDirectories go (_:as) ".." = as go as x = x : as --- --- Error reporting --- - -mapLeft :: (a -> b) -> Either a c -> Either b c -mapLeft = Bifunctor.first - -- | Remove intermediate "." and ".." directories from a path. -- -- > collapseFilePath "./foo" == "foo" |
