Skip to content

Interest in contributions to expand IO builtins? #427

Description

@shonfeder

Hello! I love using elpi. Thanks for maintaining and continuing to evolve it!

I am working on a personal toy project and have occasion to considerably expand the builtins with bindings to ocaml functions form Filename, Sys, and Unix to expand its capabilities for OS interactions and file manipulations. The FFI extension mechanism is easy and works very well, so thanks for that!

To illustrate, at this point, I've just about a dozen declarations of this sort

    MLData (result (BuiltInData.poly "A") (BuiltInData.poly "B"));

    MLCode (Pred ("readdir",
      In  (BuiltInData.string, "DirPath",
      Out (result BuiltInData.(list string) BuiltInData.string, "Contents",
      Easy "get the contents of the directory at DirPath")),
      (fun path _ ~depth:_ ->
        try !: (Ok (Sys.readdir path |> Array.to_list))
        with Sys_error e -> !: (Error e))),
    DocAbove);

As I am accumulating this growing list of MLCode entries, it occurs to me it would be easy to contribute these back to the core elpi builtin.ml. Would you be interested in these contributions? (I can understand that you may well prefer not to bloat elpi with such features :) ).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions