lang_2023/tests/classes.lang

61 lines
938 B
Text
Raw Normal View History

2023-03-31 12:10:12 +03:00
struct Fruit =
| Apple
| Orange
| Banana
struct Optional 'A =
| Some & 'A
| None
struct (Result : #Move) 'A 'B =
| & 'A
| Error & 'B
struct (Complex : #Value) =
& Float
& Float
struct Task =
& name : String
& duration : Float
2023-03-31 12:10:12 +03:00
class Employee =
& name : String
& role :
( | Director
& importance : Float
& share : Float
| Manager
& productivity :
( Productivity
| .Low
| .Average
| .High
& duration : Float
& sleep_on_work :
(SleepOnWork
| ..Yes
| ..No
))
& salary : Int
| Programmer
& skills : Float
& current_task : Optional Task
& salary : Int)
class Bag =
&
( | Apple
| Orange
| Banana)
& bag_type :
( | Small
| Medium
& weight_kg : Int
& weight_g : Int
& weight_g : Int
| Big)
& other_things : Array Something