-
-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi @tarleb! I'm trying to move more Lua APIs in my project confer to a Haskell implementation.
Essentially, I have this file that declares the APIs of my main type constructors https://github.com/tchoutri/confer/blob/main/runtime/lua/confer.lua. I feel like I am cheating a bit because these function don't do much except being annotated with type declarations in the comments. However they give a nice API to the lua configuration code:
local confer = require("confer")
local user = require("user")
-- Facts
local git_deployment = confer.fact({
name = "git",
source = ".gitconfig",
destination = user.home .. "/.gitconfig"
})Question 1: Is there in your opinion something more ergonomic for the end-user that could be done here? I essentially want to get some modicum of validation regarding the fields of the table that are populated.
Question 2: To migrate the declarations in runtime/lua/confer.lua, am I correct to assume that I must return a Module with a confer field, that is a Table, and whose fields are themselves functions that only take what they get and return them verbatim? I don't have a good intuition just yet.
I feel like DocumentedType would help here? The reference documentation of the packages is good, but the intended usage is quite hard to grasp if someone is approaching these libraries from a different background. :)