aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Util.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-01-04 19:05:14 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2018-01-04 23:15:28 +0100
commit856bc54526fc01b48a2d770406fcb9aaa2fa5da3 (patch)
treef14dcd75d3ef7ba6138a47b2b1e4d34320eee20b /src/Text/Pandoc/Lua/Util.hs
parentbdb911550c2894925be6893a5d93fca484448dd4 (diff)
downloadpandoc-856bc54526fc01b48a2d770406fcb9aaa2fa5da3.tar.gz
Use hslua utils where possible
Some helper functions and types have been moved to hslua. Change: minor
Diffstat (limited to 'src/Text/Pandoc/Lua/Util.hs')
-rw-r--r--src/Text/Pandoc/Lua/Util.hs16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
index 2958bd734..6b46cfc62 100644
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -38,7 +38,6 @@ module Text.Pandoc.Lua.Util
, addRawInt
, raiseError
, popValue
- , OrNil (..)
, PushViaCall
, pushViaCall
, pushViaConstructor
@@ -115,21 +114,6 @@ popValue = do
Left err -> Lua.throwLuaError err
Right x -> return x
--- | Newtype wrapper intended to be used for optional Lua values. Nesting this
--- type is strongly discouraged and will likely lead to a wrong result.
-newtype OrNil a = OrNil { toMaybe :: Maybe a }
-
-instance FromLuaStack a => FromLuaStack (OrNil a) where
- peek idx = do
- noValue <- Lua.isnoneornil idx
- if noValue
- then return (OrNil Nothing)
- else OrNil . Just <$> Lua.peek idx
-
-instance ToLuaStack a => ToLuaStack (OrNil a) where
- push (OrNil Nothing) = Lua.pushnil
- push (OrNil (Just x)) = Lua.push x
-
-- | Helper class for pushing a single value to the stack via a lua function.
-- See @pushViaCall@.
class PushViaCall a where