aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-03-28 15:49:50 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-03-28 15:49:50 +0300
commitd0a7dbd948351a6622a4d670bfbb8ef622e6278f (patch)
tree11339ff5e2b54070a92034c1371bdaa9cffc3db2 /src/Text/Pandoc/Writers
parent7c268c492dbd768d1f7db83bc70f1db9dc2e838c (diff)
downloadpandoc-d0a7dbd948351a6622a4d670bfbb8ef622e6278f.tar.gz
Muse writer: implement Default for WriterState
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 74251a3bd..b03ce8f90 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -47,6 +47,7 @@ import Prelude
import Control.Monad.Reader
import Control.Monad.State.Strict
import Data.Char (isSpace, isDigit, isAsciiUpper, isAsciiLower)
+import Data.Default
import Data.Text (Text)
import Data.List (intersperse, transpose, isInfixOf)
import System.FilePath (takeExtension)
@@ -76,6 +77,11 @@ data WriterState =
, stIds :: Set.Set String
}
+instance Default WriterState
+ where def = WriterState { stNotes = []
+ , stIds = Set.empty
+ }
+
evalMuse :: PandocMonad m => Muse m a -> WriterEnv -> WriterState -> m a
evalMuse document env st = evalStateT (runReaderT document env) st
@@ -85,14 +91,11 @@ writeMuse :: PandocMonad m
-> Pandoc
-> m Text
writeMuse opts document =
- evalMuse (pandocToMuse document) env st
- where env = WriterEnv { envOptions = opts
- , envTopLevel = True
- , envInsideBlock = False
- }
- st = WriterState { stNotes = []
- , stIds = Set.empty
- }
+ evalMuse (pandocToMuse document) env def
+ where env = WriterEnv { envOptions = opts
+ , envTopLevel = True
+ , envInsideBlock = False
+ }
-- | Return Muse representation of document.
pandocToMuse :: PandocMonad m