[ANN] New module function page

We finally published a documentation page about module functions. We call them like that now since we think the old name (functor) is not as descriptive.

Thank you @joshderochervlk!

NOTE: You will still have a better developer experience if you refrain from using them as much as possible! As well as all other advanced features which are listed in the docs sidebar.

But we documented them for the sake of completeness.

Btw: Don’t try to write the word functor without backticks here :wink:

12 Likes

“Module Function” is so much better of a name, for those coming from more of a non FP background.

Btw: Don’t try to write the word Module Function without backticks here :wink:

Module Function Module Function Module Function

NOTE: You will still have a better developer experience if you refrain from using them

What is it about functors that anytime they are brought up, the discussion typically revolves around avoiding them as much as possible? They seem like such a good vessel for unit testing, especially on a node project.

1 Like

They can be complicated to use, and I find them helpful when writing bindings to existing JS libraries, but if I am just writing ReScript I rarely find a need for them.

1 Like

You know how it goes: “With great power…”

That said I think most ReScript devs have a KISS mindset anyway and use module functions sparingly, but if any new users stumble upon this post, they will get the message.

1 Like

Module functions are super useful for me. Every base type like int and string gets wrapped in a more descriptive type like FirstName, PositiveInteger, USD, Milliseconds, ShortString, EmailAddress, etc. The module functions are a super convenient way to build these “newtype” with validation, equality, serialization, parsing, comparison, etc.

3 Likes