Last active
June 20, 2026 07:01
-
-
Save lagenorhynque/036b271b3d5bd53b1b9587e810032693 to your computer and use it in GitHub Desktop.
Singleton enum with record in Flix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum Person({ name = String, age = Int32 }) | |
| instance ToString[Person] { | |
| pub def toString(p: Person): String = | |
| let Person.Person({ name, age }) = p; | |
| "Person(name = ${name}, age = ${age})" | |
| } | |
| def example(): Unit \ IO = | |
| let p = Person.Person({ name = "Alice", age = 30 }); | |
| println("Person: ${p}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment