aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Marshaling
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Lua/Marshaling')
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/AST.hs13
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/CommonState.hs5
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/List.hs2
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs3
4 files changed, 13 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Lua/Marshaling/AST.hs b/src/Text/Pandoc/Lua/Marshaling/AST.hs
index 8e12d232c..b9550ba75 100644
--- a/src/Text/Pandoc/Lua/Marshaling/AST.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/AST.hs
@@ -1,6 +1,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE TypeApplications #-}
{- |
Module : Text.Pandoc.Lua.Marshaling.AST
Copyright : © 2012-2021 John MacFarlane
@@ -78,12 +79,12 @@ instance Peekable Citation where
<*> LuaUtil.rawField idx "hash"
instance Pushable Alignment where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable Alignment where
peek = Lua.peekRead
instance Pushable CitationMode where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable CitationMode where
peek = Lua.peekRead
@@ -93,22 +94,22 @@ instance Peekable Format where
peek idx = Format <$!> Lua.peek idx
instance Pushable ListNumberDelim where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable ListNumberDelim where
peek = Lua.peekRead
instance Pushable ListNumberStyle where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable ListNumberStyle where
peek = Lua.peekRead
instance Pushable MathType where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable MathType where
peek = Lua.peekRead
instance Pushable QuoteType where
- push = Lua.push . show
+ push = Lua.push . show @String
instance Peekable QuoteType where
peek = Lua.peekRead
diff --git a/src/Text/Pandoc/Lua/Marshaling/CommonState.hs b/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
index 147197c5d..7701ac35b 100644
--- a/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/CommonState.hs
@@ -1,6 +1,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TypeApplications #-}
{- |
Module : Text.Pandoc.Lua.Marshaling.CommonState
Copyright : © 2012-2021 John MacFarlane
@@ -66,7 +67,7 @@ pairsCommonState st = do
(key, pushValue):_ -> 2 <$ (Lua.push key *> pushValue st)
Lua.TypeString -> do
key <- Lua.peek idx
- case tail $ dropWhile ((/= key) . fst) commonStateFields of
+ case drop 1 $ dropWhile ((/= key) . fst) commonStateFields of
[] -> 2 <$ (Lua.pushnil *> Lua.pushnil)
(nextKey, pushValue):_ -> 2 <$ (Lua.push nextKey *> pushValue st)
_ -> 2 <$ (Lua.pushnil *> Lua.pushnil)
@@ -81,7 +82,7 @@ commonStateFields =
, ("source_url", Lua.push . Lua.Optional . stSourceURL)
, ("user_data_dir", Lua.push . Lua.Optional . stUserDataDir)
, ("trace", Lua.push . stTrace)
- , ("verbosity", Lua.push . show . stVerbosity)
+ , ("verbosity", Lua.push . show @String . stVerbosity)
]
-- | Name used by Lua for the @CommonState@ type.
diff --git a/src/Text/Pandoc/Lua/Marshaling/List.hs b/src/Text/Pandoc/Lua/Marshaling/List.hs
index 0446302a1..fcc43b0ca 100644
--- a/src/Text/Pandoc/Lua/Marshaling/List.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/List.hs
@@ -20,8 +20,8 @@ import Data.Data (Data)
import Foreign.Lua (Peekable, Pushable)
import Text.Pandoc.Walk (Walkable (..))
import Text.Pandoc.Lua.Util (defineHowTo, pushViaConstructor)
-
import qualified Foreign.Lua as Lua
+import Prelude hiding (fromList)
-- | List wrapper which is marshalled as @pandoc.List@.
newtype List a = List { fromList :: [a] }
diff --git a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
index dd7bf2e61..01af3660b 100644
--- a/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -31,7 +32,7 @@ import qualified Text.Pandoc.Lua.Util as LuaUtil
-- Reader Options
--
instance Pushable Extensions where
- push exts = Lua.push (show exts)
+ push exts = Lua.push (show @String exts)
instance Pushable TrackChanges where
push = Lua.push . showConstr . toConstr