What is the convention for naming sole function in a module?

Could be my dumbest and most trivial question so far:

If I have a module like this

DoSomething.res

let x = () => ()

and there’s only one function, or only one exposed function, or even the main function, is there a convention for naming that function?

I know there’s a convention for types

type t

But what about functions

This seems weird

DoSomething.res

let something = () => ()

called like

DoSomething.something()

Are these better?

DoSomething.f()
DoSomething.default()
DoSomething.main()

I think you should name it something descriptive. If you’re creating some object of the default type t, however, you can name it make which seems to be a fairly common convention.

3 Likes