@hackage hslua-annotations0.1.0

A type annotation generator for HSLua

hslua-annotations

GitHub Actions Status Hackage version

A type annotation generator for HSLua targetting LuaLS and EmmyLua

Table of Contents

Table of Contents

This is a small library to generate LuaLS and EmmyLua annotations from HsLua.

Installation

Add hslua-annotations to your Cabal file:

build-depends:
  hslua-annotations ^>= 0.1

Usage

import HsLua.Annotations (annotateModule, documentModule)
import HsLua.Module.Path qualified as Path
import HsLua.Packaging
import HsLua.Core qualified as Lua
import Data.Text (Text)
import Data.Text.IO qualified as TIO

-- utility function might be needed to narrow the `Module e` type
renderDocs :: Module Lua.Exception -> Text
renderDocs mod = documentModule mod

-- utility function might be needed to narrow the `Module e` type
renderAnnotations :: Module Lua.Exception -> Text
renderAnnotations mod = annotateModule mod

main :: IO ()
main = do
  TIO.writeFile "path.md" $ renderDocs Path.documentedModule
  TIO.writeFile "path.lua" $ renderAnnotations Path.documentedModule

License

This project is licensed under either of

at your option.