Description
A type annotation generator for HSLua.
Description
A type annotation generator for HSLua targetting LuaLS and EmmyLua
README.md
hslua-annotations
A type annotation generator for HSLua targetting LuaLS and EmmyLua
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
- Apache License, Version 2.0, (LICENSE_APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE or http://opensource.org/licenses/MIT)
at your option.