@@ -1,10 +1,8 @@
11{-# LANGUAGE DeriveFunctor #-}
2−{-# LANGUAGE DeriveDataTypeable #-}
32{-# LANGUAGE TypeSynonymInstances #-}
43{-# LANGUAGE FlexibleInstances #-}
54{-# LANGUAGE GeneralizedNewtypeDeriving #-}
65{-# LANGUAGE FlexibleContexts #-}
7−{-# LANGUAGE StandaloneDeriving #-}
86
97{-
108Copyright (C) 2016 Jesse Rosenthal <jrosenthal@jhu.edu>
@@ -156,7 +154,7 @@ report :: PandocMonad m => LogMessage -> m ()
156154report msg = do
157155 verbosity <- getsCommonState stVerbosity
158156 let level = messageVerbosity msg
159− when (level <= verbosity) $ do
157+ when (level <= verbosity) $
160158 logOutput msg
161159 unless (level == DEBUG) $
162160 modifyCommonState $ \st -> st{ stLog = msg : stLog st }
@@ -224,7 +222,7 @@ runIO :: PandocIO a -> IO (Either PandocError a)
224222runIO ma = flip evalStateT def $ runExceptT $ unPandocIO ma
225223
226224withMediaBag :: PandocMonad m => m a -> m (a, MediaBag)
227−withMediaBag ma = ((,)) <$> ma <*> getMediaBag
225+withMediaBag ma = (,) <$> ma <*> getMediaBag
228226
229227runIOorExplode :: PandocIO a -> IO a
230228runIOorExplode ma = runIO ma >>= handleError
@@ -250,7 +248,7 @@ instance PandocMonad PandocIO where
250248 getCurrentTime = liftIO IO.getCurrentTime
251249 getCurrentTimeZone = liftIO IO.getCurrentTimeZone
252250 newStdGen = liftIO IO.newStdGen
253− newUniqueHash = hashUnique <$> (liftIO IO.newUnique)
251+ newUniqueHash = hashUnique <$> liftIO IO.newUnique
254252 openURL u = do
255253 report $ Fetching u
256254 res <- liftIO (IO.openURL u)
@@ -266,7 +264,7 @@ instance PandocMonad PandocIO where
266264 putCommonState x = PandocIO $ lift $ put x
267265 logOutput msg = liftIO $ do
268266 UTF8.hPutStr stderr $ "[" ++
269− (map toLower $ show (messageVerbosity msg)) ++ "] "
267+ map toLower (show (messageVerbosity msg)) ++ "] "
270268 alertIndent $ lines $ showLogMessage msg
271269
272270alertIndent :: [String] -> IO ()
@@ -297,14 +295,14 @@ fetchItem :: PandocMonad m
297295fetchItem sourceURL s = do
298296 mediabag <- getMediaBag
299297 case lookupMedia s mediabag of
300− Just (mime, bs) -> return $ (BL.toStrict bs, Just mime)
298+ Just (mime, bs) -> return (BL.toStrict bs, Just mime)
301299 Nothing -> downloadOrRead sourceURL s
302300
303301downloadOrRead :: PandocMonad m
304302 => Maybe String
305303 -> String
306304 -> m (B.ByteString, Maybe MimeType)
307−downloadOrRead sourceURL s = do
305+downloadOrRead sourceURL s =
308306 case (sourceURL >>= parseURIReference' .
309307 ensureEscaped, ensureEscaped s) of
310308 (Just u, s') -> -- try fetching from relative path at source
@@ -367,7 +365,7 @@ fillMediaBag sourceURL d = walkM handleImage d
367365 let fname = basename <.> ext
368366 insertMedia fname mt bs'
369367 return $ Image attr lab (fname, tit))
370− (\e -> do
368+ (\e ->
371369 case e of
372370 PandocResourceNotFound _ -> do
373371 report $ CouldNotFetchResource src
@@ -434,7 +432,7 @@ instance Default PureState where
434432
435433
436434getPureState :: PandocPure PureState
437−getPureState = PandocPure $ lift $ lift $ get
435+getPureState = PandocPure $ lift $ lift get
438436
439437getsPureState :: (PureState -> a) -> PandocPure a
440438getsPureState f = f <$> getPureState
@@ -505,16 +503,16 @@ instance PandocMonad PandocPure where
505503 case infoFileContents <$> getFileInfo fp fps of
506504 Just bs -> return bs
507505 Nothing -> throwError $ PandocResourceNotFound fp
508− readDataFile Nothing "reference.docx" = do
506+ readDataFile Nothing "reference.docx" =
509507 (B.concat . BL.toChunks . fromArchive) <$> getsPureState stReferenceDocx
510− readDataFile Nothing "reference.odt" = do
508+ readDataFile Nothing "reference.odt" =
511509 (B.concat . BL.toChunks . fromArchive) <$> getsPureState stReferenceODT
512510 readDataFile Nothing fname = do
513511 let fname' = if fname == "MANUAL.txt" then fname else "data" </> fname
514512 readFileStrict fname'
515513 readDataFile (Just userDir) fname = do
516514 userDirFiles <- getsPureState stUserDataDir
517− case infoFileContents <$> (getFileInfo (userDir </> fname) userDirFiles) of
515+ case infoFileContents <$> getFileInfo (userDir </> fname) userDirFiles of
518516 Just bs -> return bs
519517 Nothing -> readDataFile Nothing fname
520518
@@ -524,12 +522,12 @@ instance PandocMonad PandocPure where
524522
525523 getModificationTime fp = do
526524 fps <- getsPureState stFiles
527− case infoFileMTime <$> (getFileInfo fp fps) of
525+ case infoFileMTime <$> getFileInfo fp fps of
528526 Just tm -> return tm
529527 Nothing -> throwError $ PandocIOError fp
530528 (userError "Can't get modification time")
531529
532− getCommonState = PandocPure $ lift $ get
530+ getCommonState = PandocPure $ lift get
533531 putCommonState x = PandocPure $ lift $ put x
534532
535533 logOutput _msg = return ()
@@ -613,4 +611,3 @@ instance PandocMonad m => PandocMonad (StateT st m) where
613611 getCommonState = lift getCommonState
614612 putCommonState = lift . putCommonState
615613 logOutput = lift . logOutput
616−