lang_2023/tests/classes.lang
2023-05-23 00:51:51 +03:00

59 lines
942 B
Text

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!
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)