2020-06-30 12:51:09 +03:00
|
|
|
import Data.Vect
|
|
|
|
|
|
|
|
record Person where
|
|
|
|
constructor MkPerson
|
|
|
|
firstName, middleName, lastName : String
|
|
|
|
age : Int
|
|
|
|
|
|
|
|
record SizedClass (size : Nat) where
|
|
|
|
constructor SizedClassInfo
|
|
|
|
students : Vect size Person
|
|
|
|
className : String
|
|
|
|
|
|
|
|
record Class where
|
|
|
|
constructor ClassInfo
|
|
|
|
students : Vect n Person
|
|
|
|
className : String
|
|
|
|
|
|
|
|
addStudent : Person -> Class -> Class
|
2021-12-16 21:23:18 +03:00
|
|
|
addStudent p c = { students := p :: students c } c
|
2020-06-30 12:51:09 +03:00
|
|
|
|
|
|
|
addStudent' : Person -> SizedClass n -> SizedClass (S n)
|
|
|
|
addStudent' p c = SizedClassInfo (p :: students c) (className c)
|
|
|
|
|
|
|
|
addStudent'' : Person -> SizedClass n -> SizedClass (S n)
|
2021-12-16 21:23:18 +03:00
|
|
|
addStudent'' p c = { students := p :: students c } c
|