    {-# LANGUAGE OverloadedStrings #-}
    {-# LANGUAGE ScopedTypeVariables #-}
    {-# LANGUAGE TypeApplications    #-}
    {- |
       Module      : Text.Pandoc.Lua.Module.System
       Copyright   : © 2019-2024 Albert Krewinkel
       License     : GNU GPL, version 2 or above

       Maintainer  : Albert Krewinkel <albert+pandoc@tarleb.com>
       Stability   : alpha

    Pandoc's system Lua module.
    -}
    module Text.Pandoc.Lua.Module.System
      ( documentedModule
      ) where

    import Data.Version (makeVersion)
    import HsLua
    import HsLua.Module.System
      ( arch, cmd, cp, cputime, env, getwd, ls, mkdir, os, read_file
      , rename, rm, rmdir, times, with_env, with_tmpdir, with_wd
      , write_file, xdg
      )
    import qualified HsLua.Module.System as MSys

    -- | Push the pandoc.system module on the Lua stack.
    documentedModule :: forall e. LuaError e => Module e
    documentedModule :: forall e. LuaError e => Module e
    documentedModule = Name -> Module e
    forall e. Name -> Module e
    defmodule Name
    "pandoc.system"
      Module e -> Text -> Module e
    forall a. HasDescription a => a -> Text -> a
    `withDescription` forall e. Module e -> Text
    moduleDescription @e Module e
    forall e. LuaError e => Module e
    MSys.documentedModule
      Module e -> [Field e] -> Module e
    forall e. Module e -> [Field e] -> Module e
    `withFields` [Field e
    forall e. Field e
    arch, Field e
    forall e. Field e
    os]
      Module e -> [DocumentedFunction e] -> Module e
    forall e. Module e -> [DocumentedFunction e] -> Module e
    `withFunctions`
          [         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    cputime                                DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    1,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    cmd         Name
    "command"                  DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    cp          Name
    "copy"                     DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    env         Name
    "environment"              DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    7,Int
    3]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    getwd       Name
    "get_working_directory"    DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    8]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    ls          Name
    "list_directory"           DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    19]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    mkdir       Name
    "make_directory"           DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    19]
          ,         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    read_file                              DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          ,         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    rename                                 DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    rm          Name
    "remove"                   DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    rmdir       Name
    "remove_directory"         DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    19]
          ,         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    times                                  DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    with_env    Name
    "with_environment"         DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    7,Int
    3]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    with_tmpdir Name
    "with_temporary_directory" DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    8]
          , DocumentedFunction e -> Name -> DocumentedFunction e
    forall a. HasName a => a -> Name -> a
    setName DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    with_wd     Name
    "with_working_directory"   DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    2,Int
    7,Int
    3]
          ,         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    write_file                             DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          ,         DocumentedFunction e
    forall e. LuaError e => DocumentedFunction e
    xdg                                    DocumentedFunction e -> Version -> DocumentedFunction e
    forall e. DocumentedFunction e -> Version -> DocumentedFunction e
    `since` [Int] -> Version
    v[Int
    3,Int
    7,Int
    1]
          ]
     where
      v :: [Int] -> Version
    v = [Int] -> Version
    makeVersion