Idris2/samples/deprec.idr
Edwin Brady 4f10bfcfd2 Copy samples directory from Idris2-boot
This is referred to in the documentation, so should be there
2020-06-30 10:51:09 +01:00

26 lines
682 B
Idris

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
addStudent p c = record { students = p :: students c } c
addStudent' : Person -> SizedClass n -> SizedClass (S n)
addStudent' p c = SizedClassInfo (p :: students c) (className c)
addStudent'' : Person -> SizedClass n -> SizedClass (S n)
addStudent'' p c = record { students = p :: students c } c