From f8c1efb8c12dfd2300d42cbe40f5692d6897dae3 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Wed, 27 Nov 2019 10:32:18 -0500 Subject: [PATCH] Cleanup TODOs --- src/Rib/Markup/Pandoc.hs | 8 ++------ src/Rib/Shake.hs | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Rib/Markup/Pandoc.hs b/src/Rib/Markup/Pandoc.hs index d28ed31..640f0ed 100644 --- a/src/Rib/Markup/Pandoc.hs +++ b/src/Rib/Markup/Pandoc.hs @@ -146,14 +146,13 @@ detectReader :: m (ReaderOptions -> Text -> m1 Pandoc) detectReader f = do ext <- - catchInMonadError (UnknownExtension . show) $ + liftEither . first (UnknownExtension . show) $ fileExtension f - liftEither $ maybeToRight (UnknownExtension ext) $ + liftEither . maybeToRight (UnknownExtension ext) $ formats !? ext where formats :: Map String (ReaderOptions -> Text -> m1 Pandoc) formats = - -- TODO: Expand this list, cf. `Text.Pandoc.Readers.readers` fromList [ (".md", readMarkdown), (".rst", readRST), @@ -161,9 +160,6 @@ detectReader f = do (".tex", readLaTeX), (".ipynb", readIpynb) ] - -- Re-constrain code constrained by MonadThrow to be constrained by - -- MonadError instead. - catchInMonadError ef = either (throwError . ef) pure -- | Flatten a Pandoc 'Meta' into a well-structured JSON object. -- diff --git a/src/Rib/Shake.hs b/src/Rib/Shake.hs index 4fcf532..337c3fa 100644 --- a/src/Rib/Shake.hs +++ b/src/Rib/Shake.hs @@ -96,7 +96,6 @@ readDocMulti pat = do mkDocumentFrom ! #relpath f ! #path (input f) - -- TODO: Make error reporting nice, without Shake's stack trace ugliness. case result of Left e -> fail $ "Error converting " <> toFilePath f <> " to HTML: " <> show e