Re:Gluon – A static, type-inferred and embeddable language w...
by Miky on Friday June 22, 2018 @08:31PM
(#17378685)
In both Gluon and Haskell, functions without arguments can be represented as functions over the unit type:
f: () -> SomeType
which can be called via:
f ()
There are examples of this in the Gluon book (http://gluon-lang.org/book/syntax-and-semantics.html). There are no syntax-related difficulties at all here. This is also how it's done in OCaml and related languages.
(Note: This is (basically) useless in Haskell, since laziness makes this have the same semantics as a constant:
f :: SomeType
But since Gluon is strict, there's a pretty important difference between the two.)
(Note: This is (basically) useless in Haskell, since laziness makes this have the same semantics as a constant:
But since Gluon is strict, there's a pretty important difference between the two.)