Murat Kasimov

More about me

Я language (β)

/Я language (β)/Snippets/Initialising data structures/

Term initialising usually refers to languages with manual memory management, but here it's used in context of definig it standalone.

Regarding Maybe functor, Unit represents a slot with a value inside while Void represents empty box:

> Only `hu'st` A `ryo` Enter @ Maybe = Exist `har'st` A > Null `hu'st` A `ryo` Enter @ Maybe = Empty `har` Unit

The same way it works for List and Nonempty List:

> Only `hu'st` A `ryo` Enter @ List > Only `hu'st` A `ryo` Enter @ Nonempty List > Null `hu'st` A `ryo` Enter @ List

But the easiest way is to use literal package:

> [ ] : Maybe Latin > [ A ] : Maybe Latin > [ ] : List Latin > [ A , B , C ] : List Latin > [ A , B , C ] : Nonempty List Latin