Hacker News new | past | comments | ask | show | jobs | submit login
Flunct: Well-typed, fluent APIs in SML (github.com/oriroth)
46 points by jez on June 26, 2023 | hide | past | favorite | 14 comments



Ever since looking at SML, I often find myself thinking: "Would this be nice in SML?". And then I imagine all the nice pattern matching and type checking shortening the code. So any post about some library for SML raises my interest.

Having only learned from a book and with very few and little projects in SML, I have no idea, how they managed to put the HTML syntax in there. Clearly the carets are a start and the dollar signs the end delimiter, but then there are also things like backticks in there, before strings, which remind me of unquote of lisp. But why would one need to unquote strings? Anyway, it does look elegant. Maybe an example of how to compose HTML from multiple parts would also be great to have as an example (-> template engine).

Can anyone shed light on the general approach with ^^ and $$ this is implemented in SML? What kind of language constructs are involved?

EDIT: Also interesting, that they have written their own Test thingy: https://github.com/OriRoth/flunct/blob/main/test/test.sml#L4


> Maybe an example of how to compose HTML from multiple parts would also be great to have as an example (-> template engine).

There are examples in the paper https://dl.acm.org/doi/10.1145/3586057 (last section I think).


Thanks for that! Looks great. For anyone else looking: I think it is page 23 (105:23).


They also have a paper on the approach, though it doesn’t seem linked from the repo.

https://dl.acm.org/doi/pdf/10.1145/3586057


The preprint version has the appendices which document the tool.

https://arxiv.org/abs/2211.01473


What's an industrial strength toolchain that one could use for SML today? Compiler, package manager, ide etc... that integrate well.


Isabelle, an “Academial strength” theorem proving environment, is built on PolyML, and has many features for making ML development more pleasant. https://web.cs.wpi.edu/~dd/resources_isabelle/isabelle_progr...

https://isabelle.systems/


For the IDE use case, I made a language server for SML: https://azdavis.net/posts/millet/


PolyML.org, or MLton.org. The guy that worked on MLton's multicore support went on to the Ocaml team and helped them get multicore working.


+1 for MLton. The lead maintainer was my compilers professor in university and he's a dedicated man who _loves_ what he does. It shows in his work and using MLton was a very nice experience, especially compared to SML/NJ (which isn't bad, just a bit more difficult and the straight forward compilation of MLton).


Issues like this and a few older ones give me a pause. https://github.com/MLton/mlton/issues/473

Is there sufficient use of MLTon amd64 backend out there to consider it mature? or Do people prefer the LLVM or C backend instead in general?


Matthew Fluet checked in the fix on 2022-02-20.


With some project names, I wonder if the puns are intentional or accidental. For instance this one sounds like "to flunk/flunked", which is not the nicest association?


See also "Fling: a fluent API generator" by the same author https://github.com/OriRoth/fling




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: