    {-# LANGUAGE OverloadedStrings    #-}
    {-# LANGUAGE LambdaCase           #-}
    {- |
    Copyright               : © 2021-2026 Albert Krewinkel
    SPDX-License-Identifier : MIT
    Maintainer              : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>

    Marshaling/unmarshaling functions of table 'Cell' values.
    -}
    module Text.Pandoc.Lua.Marshal.Cell
      ( peekCell
      , peekCellFuzzy
      , pushCell
      , typeCell
      , mkCell
      ) where

    import Control.Applicative (optional)
    import Control.Monad ((<$!>))
    import Data.Aeson (encode)
    import Data.Maybe (fromMaybe)
    import HsLua
    import Text.Pandoc.Lua.Marshal.Alignment (peekAlignment, pushAlignment)
    import Text.Pandoc.Lua.Marshal.Attr (peekAttr, pushAttr)
    import {-# SOURCE #-} Text.Pandoc.Lua.Marshal.Block
      ( peekBlocksFuzzy, pushBlocks )
    import Text.Pandoc.Lua.Marshal.Filter (peekFilter)
    import Text.Pandoc.Lua.Marshal.Shared (walkBlocksAndInlines)
    import Text.Pandoc.Definition

    -- | Push a table cell as a table with fields @attr@, @alignment@,
    -- @row_span@, @col_span@, and @contents@.
    pushCell :: LuaError e => Cell -> LuaE e ()
    pushCell :: forall e. LuaError e => Cell -> LuaE e ()
    pushCell = DocumentedTypeWithList e Cell (ZonkAny 2) -> Cell -> LuaE e ()
    forall e a itemtype.
    LuaError e =>
    DocumentedTypeWithList e a itemtype -> a -> LuaE e ()
    pushUD DocumentedTypeWithList e Cell (ZonkAny 2)
    forall e. LuaError e => DocumentedType e Cell
    typeCell

    -- | Retrieves a 'Cell' object from the stack.
    peekCell :: LuaError e => Peeker e Cell
    peekCell :: forall e. LuaError e => Peeker e Cell
    peekCell = DocumentedTypeWithList e Cell (ZonkAny 0) -> Peeker e Cell
    forall e a itemtype.
    LuaError e =>
    DocumentedTypeWithList e a itemtype -> Peeker e a
    peekUD DocumentedTypeWithList e Cell (ZonkAny 0)
    forall e. LuaError e => DocumentedType e Cell
    typeCell

    -- | Retrieves a 'Cell' from the stack, accepting either a 'pandoc Cell'
    -- userdata object or a table with fields @attr@, @alignment@, @row_span@,
    -- @col_span@, and @contents@.
    peekCellFuzzy :: LuaError e => Peeker e Cell
    peekCellFuzzy :: forall e. LuaError e => Peeker e Cell
    peekCellFuzzy StackIndex
    idx = LuaE e Type -> Peek e Type
    forall e a. LuaE e a -> Peek e a
    liftLua (StackIndex -> LuaE e Type
    forall e. StackIndex -> LuaE e Type
    ltype StackIndex
    idx) Peek e Type -> (Type -> Peek e Cell) -> Peek e Cell
    forall a b. Peek e a -> (a -> Peek e b) -> Peek e b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \case
      Type
    TypeUserdata -> Peeker e Cell
    forall e. LuaError e => Peeker e Cell
    peekCell StackIndex
    idx
      Type
    TypeTable -> do
        attr <- Peeker e Attr -> Name -> Peeker e Attr
    forall e a. LuaError e => Peeker e a -> Name -> Peeker e a
    peekFieldRaw Peeker e Attr
    forall e. LuaError e => Peeker e Attr
    peekAttr Name
    "attr" StackIndex
    idx
        algn <- peekFieldRaw peekAlignment "alignment" idx
        rs   <- RowSpan <$!> peekFieldRaw peekIntegral "row_span" idx
        cs   <- ColSpan <$!> peekFieldRaw peekIntegral "col_span" idx
        blks <- peekFieldRaw peekBlocksFuzzy "contents" idx
        return $! Cell attr algn rs cs blks
      Type
    _ -> ByteString -> Peek e Cell
    forall a e. ByteString -> Peek e a
    failPeek (ByteString -> Peek e Cell) -> Peek e ByteString -> Peek e Cell
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< Name -> StackIndex -> Peek e ByteString
    forall e. Name -> StackIndex -> Peek e ByteString
    typeMismatchMessage Name
    "Cell or table" StackIndex
    idx

    -- | Cell object type.
    typeCell :: LuaError e => DocumentedType e Cell
    typeCell :: forall e. LuaError e => DocumentedType e Cell
    typeCell = Name
    -> [(Operation, DocumentedFunction e)]
    -> [Member e (DocumentedFunction e) Cell]
    -> DocumentedType e Cell
    forall e a.
    LuaError e =>
    Name
    -> [(Operation, DocumentedFunction e)]
    -> [Member e (DocumentedFunction e) a]
    -> DocumentedType e a
    deftype Name
    "Cell"
      [ Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall e.
    Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    operation Operation
    Eq (DocumentedFunction e -> (Operation, DocumentedFunction e))
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall a b. (a -> b) -> a -> b
    $ Name
    -> (Maybe Cell -> Maybe Cell -> LuaE e Bool)
    -> HsFnPrecursor e (Maybe Cell -> Maybe Cell -> LuaE e Bool)
    forall a e. Name -> a -> HsFnPrecursor e a
    defun Name
    "__eq"
         ### liftPure2 (\a b -> fromMaybe False ((==) <$> a <*> b))
         HsFnPrecursor e (Maybe Cell -> Maybe Cell -> LuaE e Bool)
    -> Parameter e (Maybe Cell)
    -> HsFnPrecursor e (Maybe Cell -> LuaE e Bool)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Peeker e (Maybe Cell)
    -> TypeSpec -> Text -> Text -> Parameter e (Maybe Cell)
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter (Peek e Cell -> Peek e (Maybe Cell)
    forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
    optional (Peek e Cell -> Peek e (Maybe Cell))
    -> (StackIndex -> Peek e Cell) -> Peeker e (Maybe Cell)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . StackIndex -> Peek e Cell
    forall e. LuaError e => Peeker e Cell
    peekCell) TypeSpec
    "Cell" Text
    "self" Text
    ""
         HsFnPrecursor e (Maybe Cell -> LuaE e Bool)
    -> Parameter e (Maybe Cell) -> HsFnPrecursor e (LuaE e Bool)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Peeker e (Maybe Cell)
    -> TypeSpec -> Text -> Text -> Parameter e (Maybe Cell)
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter (Peek e Cell -> Peek e (Maybe Cell)
    forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a)
    optional (Peek e Cell -> Peek e (Maybe Cell))
    -> (StackIndex -> Peek e Cell) -> Peeker e (Maybe Cell)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . StackIndex -> Peek e Cell
    forall e. LuaError e => Peeker e Cell
    peekCell) TypeSpec
    "any" Text
    "object" Text
    ""
         HsFnPrecursor e (LuaE e Bool)
    -> FunctionResults e Bool -> DocumentedFunction e
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher e Bool -> TypeSpec -> Text -> FunctionResults e Bool
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher e Bool
    forall e. Pusher e Bool
    pushBool TypeSpec
    "boolean" Text
    "true iff the two values are equal"
      , Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall e.
    Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    operation Operation
    Tostring (DocumentedFunction e -> (Operation, DocumentedFunction e))
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall a b. (a -> b) -> a -> b
    $ (Cell -> LuaE e String) -> HsFnPrecursor e (Cell -> LuaE e String)
    forall a e. a -> HsFnPrecursor e a
    lambda
        ### liftPure show
        HsFnPrecursor e (Cell -> LuaE e String)
    -> Parameter e Cell -> HsFnPrecursor e (LuaE e String)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> (StackIndex -> Peek e Cell)
    -> TypeSpec -> Text -> Text -> Parameter e Cell
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter StackIndex -> Peek e Cell
    forall e. LuaError e => Peeker e Cell
    peekCell TypeSpec
    "Cell" Text
    "self" Text
    ""
        HsFnPrecursor e (LuaE e String)
    -> FunctionResults e String -> DocumentedFunction e
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher e String -> TypeSpec -> Text -> FunctionResults e String
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher e String
    forall e. String -> LuaE e ()
    pushString TypeSpec
    "string" Text
    "native Haskell representation"
      , Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall e.
    Operation
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    operation (Name -> Operation
    CustomOperation Name
    "__tojson") (DocumentedFunction e -> (Operation, DocumentedFunction e))
    -> DocumentedFunction e -> (Operation, DocumentedFunction e)
    forall a b. (a -> b) -> a -> b
    $ (Cell -> LuaE e ByteString)
    -> HsFnPrecursor e (Cell -> LuaE e ByteString)
    forall a e. a -> HsFnPrecursor e a
    lambda
        ### liftPure encode
        HsFnPrecursor e (Cell -> LuaE e ByteString)
    -> Parameter e Cell -> HsFnPrecursor e (LuaE e ByteString)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> DocumentedType e Cell -> Text -> Text -> Parameter e Cell
    forall e a itemtype.
    LuaError e =>
    DocumentedTypeWithList e a itemtype
    -> Text -> Text -> Parameter e a
    udparam DocumentedType e Cell
    forall e. LuaError e => DocumentedType e Cell
    typeCell Text
    "self" Text
    ""
        HsFnPrecursor e (LuaE e ByteString)
    -> FunctionResults e ByteString -> DocumentedFunction e
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher e ByteString
    -> TypeSpec -> Text -> FunctionResults e ByteString
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher e ByteString
    forall e. Pusher e ByteString
    pushLazyByteString TypeSpec
    "string" Text
    "JSON representation"
      ]
      [ Name
    -> Text
    -> (Pusher e Attr, Cell -> Attr)
    -> (Peeker e Attr, Cell -> Attr -> Cell)
    -> Member e (DocumentedFunction e) Cell
    forall e b a fn.
    LuaError e =>
    Name
    -> Text
    -> (Pusher e b, a -> b)
    -> (Peeker e b, a -> b -> a)
    -> Member e fn a
    property Name
    "attr" Text
    "cell attributes"
          (Pusher e Attr
    forall e. LuaError e => Pusher e Attr
    pushAttr, \(Cell Attr
    attr Alignment
    _ RowSpan
    _ ColSpan
    _ [Block]
    _) -> Attr
    attr)
          (Peeker e Attr
    forall e. LuaError e => Peeker e Attr
    peekAttr, \(Cell Attr
    _ Alignment
    align RowSpan
    rs ColSpan
    cs [Block]
    blks) Attr
    attr ->
                       Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
    Cell Attr
    attr Alignment
    align RowSpan
    rs ColSpan
    cs [Block]
    blks)
      , Name
    -> Text
    -> (Pusher e Alignment, Cell -> Alignment)
    -> (Peeker e Alignment, Cell -> Alignment -> Cell)
    -> Member e (DocumentedFunction e) Cell
    forall e b a fn.
    LuaError e =>
    Name
    -> Text
    -> (Pusher e b, a -> b)
    -> (Peeker e b, a -> b -> a)
    -> Member e fn a
    property Name
    "alignment" Text
    "alignment of cell contents"
          (Pusher e Alignment
    forall e. Pusher e Alignment
    pushAlignment, \(Cell Attr
    _ Alignment
    align RowSpan
    _ ColSpan
    _ [Block]
    _) -> Alignment
    align)
          (Peeker e Alignment
    forall e. Peeker e Alignment
    peekAlignment, \(Cell Attr
    attr Alignment
    _ RowSpan
    rs ColSpan
    cs [Block]
    blks) Alignment
    align ->
                            Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
    Cell Attr
    attr Alignment
    align RowSpan
    rs ColSpan
    cs [Block]
    blks)
      , Name
    -> Text
    -> (Pusher e Int, Cell -> Int)
    -> (Peeker e Int, Cell -> Int -> Cell)
    -> Member e (DocumentedFunction e) Cell
    forall e b a fn.
    LuaError e =>
    Name
    -> Text
    -> (Pusher e b, a -> b)
    -> (Peeker e b, a -> b -> a)
    -> Member e fn a
    property Name
    "row_span" Text
    "number of rows over which this cell spans"
          (Pusher e Int
    forall a e. (Integral a, Show a) => a -> LuaE e ()
    pushIntegral, \(Cell Attr
    _ Alignment
    _ (RowSpan Int
    rs) ColSpan
    _ [Block]
    _) -> Int
    rs)
          (Peeker e Int
    forall a e. (Integral a, Read a) => Peeker e a
    peekIntegral, \(Cell Attr
    attr Alignment
    align RowSpan
    _ ColSpan
    cs [Block]
    blks) Int
    rs ->
                           Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
    Cell Attr
    attr Alignment
    align (Int -> RowSpan
    RowSpan Int
    rs) ColSpan
    cs [Block]
    blks)
      , Name
    -> Text
    -> (Pusher e Int, Cell -> Int)
    -> (Peeker e Int, Cell -> Int -> Cell)
    -> Member e (DocumentedFunction e) Cell
    forall e b a fn.
    LuaError e =>
    Name
    -> Text
    -> (Pusher e b, a -> b)
    -> (Peeker e b, a -> b -> a)
    -> Member e fn a
    property Name
    "col_span" Text
    "number of columns over which this cell spans"
          (Pusher e Int
    forall a e. (Integral a, Show a) => a -> LuaE e ()
    pushIntegral, \(Cell Attr
    _ Alignment
    _ RowSpan
    _ (ColSpan Int
    rs) [Block]
    _) -> Int
    rs)
          (Peeker e Int
    forall a e. (Integral a, Read a) => Peeker e a
    peekIntegral, \(Cell Attr
    attr Alignment
    align RowSpan
    rs ColSpan
    _ [Block]
    blks) Int
    cs ->
                           Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
    Cell Attr
    attr Alignment
    align RowSpan
    rs (Int -> ColSpan
    ColSpan Int
    cs) [Block]
    blks)
      , Name
    -> Text
    -> (Pusher e [Block], Cell -> [Block])
    -> (Peeker e [Block], Cell -> [Block] -> Cell)
    -> Member e (DocumentedFunction e) Cell
    forall e b a fn.
    LuaError e =>
    Name
    -> Text
    -> (Pusher e b, a -> b)
    -> (Peeker e b, a -> b -> a)
    -> Member e fn a
    property Name
    "contents" Text
    "cell contents"
          (Pusher e [Block]
    forall e. LuaError e => Pusher e [Block]
    pushBlocks, \(Cell Attr
    _ Alignment
    _ RowSpan
    _ ColSpan
    _ [Block]
    blks) -> [Block]
    blks)
          (Peeker e [Block]
    forall e. LuaError e => Peeker e [Block]
    peekBlocksFuzzy, \(Cell Attr
    attr Alignment
    align RowSpan
    rs ColSpan
    cs [Block]
    _) [Block]
    blks ->
                              Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell
    Cell Attr
    attr Alignment
    align RowSpan
    rs ColSpan
    cs [Block]
    blks)

      , AliasIndex
    -> Text -> [AliasIndex] -> Member e (DocumentedFunction e) Cell
    forall e fn a. AliasIndex -> Text -> [AliasIndex] -> Member e fn a
    alias AliasIndex
    "content"    Text
    "alias for contents" [AliasIndex
    "contents"]
      , AliasIndex
    -> Text -> [AliasIndex] -> Member e (DocumentedFunction e) Cell
    forall e fn a. AliasIndex -> Text -> [AliasIndex] -> Member e fn a
    alias AliasIndex
    "identifier" Text
    "cell ID"         [AliasIndex
    "attr", AliasIndex
    "identifier"]
      , AliasIndex
    -> Text -> [AliasIndex] -> Member e (DocumentedFunction e) Cell
    forall e fn a. AliasIndex -> Text -> [AliasIndex] -> Member e fn a
    alias AliasIndex
    "classes"    Text
    "cell classes"    [AliasIndex
    "attr", AliasIndex
    "classes"]
      , AliasIndex
    -> Text -> [AliasIndex] -> Member e (DocumentedFunction e) Cell
    forall e fn a. AliasIndex -> Text -> [AliasIndex] -> Member e fn a
    alias AliasIndex
    "attributes" Text
    "cell attributes" [AliasIndex
    "attr", AliasIndex
    "attributes"]

      , DocumentedFunction e -> Member e (DocumentedFunction e) Cell
    forall e a.
    DocumentedFunction e -> Member e (DocumentedFunction e) a
    method (DocumentedFunction e -> Member e (DocumentedFunction e) Cell)
    -> DocumentedFunction e -> Member e (DocumentedFunction e) Cell
    forall a b. (a -> b) -> a -> b
    $ Name
    -> (Cell -> Filter -> LuaE e Cell)
    -> HsFnPrecursor e (Cell -> Filter -> LuaE e Cell)
    forall a e. Name -> a -> HsFnPrecursor e a
    defun Name
    "walk"
        ### flip walkBlocksAndInlines
        HsFnPrecursor e (Cell -> Filter -> LuaE e Cell)
    -> Parameter e Cell -> HsFnPrecursor e (Filter -> LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> (StackIndex -> Peek e Cell)
    -> TypeSpec -> Text -> Text -> Parameter e Cell
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter StackIndex -> Peek e Cell
    forall e. LuaError e => Peeker e Cell
    peekCell TypeSpec
    "Cell" Text
    "self" Text
    ""
        HsFnPrecursor e (Filter -> LuaE e Cell)
    -> Parameter e Filter -> HsFnPrecursor e (LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Peeker e Filter -> TypeSpec -> Text -> Text -> Parameter e Filter
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e Filter
    forall e. LuaError e => Peeker e Filter
    peekFilter TypeSpec
    "Filter" Text
    "lua_filter" Text
    "table of filter functions"
        HsFnPrecursor e (LuaE e Cell)
    -> FunctionResults e Cell -> DocumentedFunction e
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher e Cell -> TypeSpec -> Text -> FunctionResults e Cell
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher e Cell
    forall e. LuaError e => Cell -> LuaE e ()
    pushCell TypeSpec
    "Cell" Text
    "modified cell"
      ]

    -- | Constructor function for 'Cell' values.
    mkCell :: LuaError e => DocumentedFunction e
    mkCell :: forall e. LuaError e => DocumentedFunction e
    mkCell = Name
    -> ([Block]
        -> Maybe Alignment
        -> Maybe Int
        -> Maybe Int
        -> Maybe Attr
        -> LuaE e Cell)
    -> HsFnPrecursor
         e
         ([Block]
          -> Maybe Alignment
          -> Maybe Int
          -> Maybe Int
          -> Maybe Attr
          -> LuaE e Cell)
    forall a e. Name -> a -> HsFnPrecursor e a
    defun Name
    "Cell"
      ### liftPure5 (\blocks mAlign mRowSpan mColSpan mAttr -> Cell
                      (fromMaybe nullAttr mAttr)
                      (fromMaybe AlignDefault mAlign)
                      (maybe 1 RowSpan mRowSpan)
                      (maybe 1 ColSpan mColSpan)
                      blocks)
      HsFnPrecursor
      e
      ([Block]
       -> Maybe Alignment
       -> Maybe Int
       -> Maybe Int
       -> Maybe Attr
       -> LuaE e Cell)
    -> Parameter e [Block]
    -> HsFnPrecursor
         e
         (Maybe Alignment
          -> Maybe Int -> Maybe Int -> Maybe Attr -> LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Peeker e [Block] -> TypeSpec -> Text -> Text -> Parameter e [Block]
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e [Block]
    forall e. LuaError e => Peeker e [Block]
    peekBlocksFuzzy TypeSpec
    "Blocks" Text
    "blocks" Text
    "cell contents"
      HsFnPrecursor
      e
      (Maybe Alignment
       -> Maybe Int -> Maybe Int -> Maybe Attr -> LuaE e Cell)
    -> Parameter e (Maybe Alignment)
    -> HsFnPrecursor
         e (Maybe Int -> Maybe Int -> Maybe Attr -> LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Parameter e Alignment -> Parameter e (Maybe Alignment)
    forall e a. Parameter e a -> Parameter e (Maybe a)
    opt (Peeker e Alignment
    -> TypeSpec -> Text -> Text -> Parameter e Alignment
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e Alignment
    forall e. Peeker e Alignment
    peekAlignment TypeSpec
    "Alignment" Text
    "align"
               Text
    "text alignment; defaults to `AlignDefault`")
      HsFnPrecursor
      e (Maybe Int -> Maybe Int -> Maybe Attr -> LuaE e Cell)
    -> Parameter e (Maybe Int)
    -> HsFnPrecursor e (Maybe Int -> Maybe Attr -> LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Parameter e Int -> Parameter e (Maybe Int)
    forall e a. Parameter e a -> Parameter e (Maybe a)
    opt (Peeker e Int -> TypeSpec -> Text -> Text -> Parameter e Int
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e Int
    forall a e. (Integral a, Read a) => Peeker e a
    peekIntegral TypeSpec
    "integer" Text
    "rowspan"
               Text
    "number of rows occupied by the cell; defaults to `1`")
      HsFnPrecursor e (Maybe Int -> Maybe Attr -> LuaE e Cell)
    -> Parameter e (Maybe Int)
    -> HsFnPrecursor e (Maybe Attr -> LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Parameter e Int -> Parameter e (Maybe Int)
    forall e a. Parameter e a -> Parameter e (Maybe a)
    opt (Peeker e Int -> TypeSpec -> Text -> Text -> Parameter e Int
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e Int
    forall a e. (Integral a, Read a) => Peeker e a
    peekIntegral TypeSpec
    "integer" Text
    "colspan"
               Text
    "number of columns occupied by the cell; defaults to `1`")
      HsFnPrecursor e (Maybe Attr -> LuaE e Cell)
    -> Parameter e (Maybe Attr) -> HsFnPrecursor e (LuaE e Cell)
    forall e a b.
    HsFnPrecursor e (a -> b) -> Parameter e a -> HsFnPrecursor e b
    <#> Parameter e Attr -> Parameter e (Maybe Attr)
    forall e a. Parameter e a -> Parameter e (Maybe a)
    opt (Peeker e Attr -> TypeSpec -> Text -> Text -> Parameter e Attr
    forall e a. Peeker e a -> TypeSpec -> Text -> Text -> Parameter e a
    parameter Peeker e Attr
    forall e. LuaError e => Peeker e Attr
    peekAttr TypeSpec
    "Attr" Text
    "attr" Text
    "cell attributes")
      HsFnPrecursor e (LuaE e Cell)
    -> FunctionResults e Cell -> DocumentedFunction e
    forall e a.
    HsFnPrecursor e (LuaE e a)
    -> FunctionResults e a -> DocumentedFunction e
    =#> Pusher e Cell -> TypeSpec -> Text -> FunctionResults e Cell
    forall e a. Pusher e a -> TypeSpec -> Text -> FunctionResults e a
    functionResult Pusher e Cell
    forall e. LuaError e => Cell -> LuaE e ()
    pushCell TypeSpec
    "Cell" Text
    "new Cell object"
      #? "Create a new table cell."