Sometimes, when we are creating libraries for other users, we might want to group similar functions together to improve user experience.


Suppose we are creating a library that allow the user to access the file system. And we wish that our code looks like this:"Hello world.txt")
First, we need to create a tagged union with only a single tag:
FileSystem =
Then, create a constant alias:
fs =
After that, we can proceed to define the functions we intend to expose:
(this FileSystem).open(filename String) = undefined
(this FileSystem).rename(oldname String) as(newname String) = undefined
(this FileSystem).delete(filename String) = undefined
And the client can use them as follows:"Hello world.txt")
=fs.rename("") as("")