{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE FlexibleInstances    #-}
{- |
   Module      : Text.Pandoc.Lua.Orphans
   Copyright   : © 2012-2022 John MacFarlane
                 © 2017-2022 Albert Krewinkel
   License     : GNU GPL, version 2 or above

   Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
   Stability   : alpha

Orphan instances for Lua's Pushable and Peekable type classes.
-}
module Text.Pandoc.Lua.Orphans () where

import Data.Version (Version)
import HsLua
import HsLua.Module.Version (peekVersionFuzzy)
import Text.Pandoc.Definition
import Text.Pandoc.Lua.Marshal.AST
import Text.Pandoc.Lua.Marshal.CommonState ()
import Text.Pandoc.Lua.Marshal.Context ()
import Text.Pandoc.Lua.Marshal.PandocError()
import Text.Pandoc.Lua.Marshal.ReaderOptions ()
import Text.Pandoc.Lua.Marshal.Sources (pushSources)
import Text.Pandoc.Lua.ErrorConversion ()
import Text.Pandoc.Sources (Sources)

instance Pushable Pandoc where
  push :: forall e. LuaError e => Pandoc -> LuaE e ()
push = forall e. LuaError e => Pandoc -> LuaE e ()
pushPandoc

instance Pushable Meta where
  push :: forall e. LuaError e => Meta -> LuaE e ()
push = forall e. LuaError e => Meta -> LuaE e ()
pushMeta

instance Pushable MetaValue where
  push :: forall e. LuaError e => MetaValue -> LuaE e ()
push = forall e. LuaError e => MetaValue -> LuaE e ()
pushMetaValue

instance Pushable Block where
  push :: forall e. LuaError e => Block -> LuaE e ()
push = forall e. LuaError e => Block -> LuaE e ()
pushBlock

instance {-# OVERLAPPING #-} Pushable [Block] where
  push :: forall e. LuaError e => [Block] -> LuaE e ()
push = forall e. LuaError e => [Block] -> LuaE e ()
pushBlocks

instance Pushable Alignment where
  push :: forall e. LuaError e => Alignment -> LuaE e ()
push = forall e. String -> LuaE e ()
pushString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show

instance Pushable CitationMode where
  push :: forall e. LuaError e => CitationMode -> LuaE e ()
push = forall e. Pusher e CitationMode
pushCitationMode

instance Pushable Format where
  push :: forall e. LuaError e => Format -> LuaE e ()
push = forall e. Pusher e Format
pushFormat

instance Pushable ListNumberDelim where
  push :: forall e. LuaError e => ListNumberDelim -> LuaE e ()
push = forall e. String -> LuaE e ()
pushString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show

instance Pushable ListNumberStyle where
  push :: forall e. LuaError e => ListNumberStyle -> LuaE e ()
push = forall e. String -> LuaE e ()
pushString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show

instance Pushable MathType where
  push :: forall e. LuaError e => MathType -> LuaE e ()
push = forall e. Pusher e MathType
pushMathType

instance Pushable QuoteType where
  push :: forall e. LuaError e => QuoteType -> LuaE e ()
push = forall e. Pusher e QuoteType
pushQuoteType

instance Pushable Cell where
  push :: forall e. LuaError e => Cell -> LuaE e ()
push = forall e. LuaError e => Cell -> LuaE e ()
pushCell

instance Pushable Inline where
  push :: forall e. LuaError e => Inline -> LuaE e ()
push = forall e. LuaError e => Inline -> LuaE e ()
pushInline

instance {-# OVERLAPPING #-} Pushable [Inline] where
  push :: forall e. LuaError e => [Inline] -> LuaE e ()
push = forall e. LuaError e => [Inline] -> LuaE e ()
pushInlines

instance Pushable Citation where
  push :: forall e. LuaError e => Citation -> LuaE e ()
push = forall e. LuaError e => Citation -> LuaE e ()
pushCitation

instance Pushable Row where
  push :: forall e. LuaError e => Row -> LuaE e ()
push = forall e. LuaError e => Row -> LuaE e ()
pushRow

instance Pushable TableBody where
  push :: forall e. LuaError e => TableBody -> LuaE e ()
push = forall e. LuaError e => TableBody -> LuaE e ()
pushTableBody

instance Pushable TableFoot where
  push :: forall e. LuaError e => TableFoot -> LuaE e ()
push = forall e. LuaError e => TableFoot -> LuaE e ()
pushTableFoot

instance Pushable TableHead where
  push :: forall e. LuaError e => TableHead -> LuaE e ()
push = forall e. LuaError e => TableHead -> LuaE e ()
pushTableHead

-- These instances exist only for testing. It's a hack to avoid making
-- the marshalling modules public.
instance Peekable Inline where
  safepeek :: forall e. LuaError e => Peeker e Inline
safepeek = forall e. LuaError e => Peeker e Inline
peekInline

instance Peekable Block where
  safepeek :: forall e. LuaError e => Peeker e Block
safepeek = forall e. LuaError e => Peeker e Block
peekBlock

instance Peekable Cell where
  safepeek :: forall e. LuaError e => Peeker e Cell
safepeek = forall e. LuaError e => Peeker e Cell
peekCell

instance Peekable Meta where
  safepeek :: forall e. LuaError e => Peeker e Meta
safepeek = forall e. LuaError e => Peeker e Meta
peekMeta

instance Peekable Pandoc where
  safepeek :: forall e. LuaError e => Peeker e Pandoc
safepeek = forall e. LuaError e => Peeker e Pandoc
peekPandoc

instance Peekable Row where
  safepeek :: forall e. LuaError e => Peeker e Row
safepeek = forall e. LuaError e => Peeker e Row
peekRow

instance Peekable Version where
  safepeek :: forall e. LuaError e => Peeker e Version
safepeek = forall e. LuaError e => Peeker e Version
peekVersionFuzzy

instance {-# OVERLAPPING #-} Peekable Attr where
  safepeek :: forall e. LuaError e => Peeker e Attr
safepeek = forall e. LuaError e => Peeker e Attr
peekAttr

instance Pushable Sources where
  push :: forall e. LuaError e => Sources -> LuaE e ()
push = forall e. LuaError e => Sources -> LuaE e ()
pushSources