Records.agda 379 B

1234567891011121314151617181920212223
  1. module Records where
  2. open import Common.Nat
  3. open import Common.IO
  4. open import Common.Unit
  5. record Test : Set where
  6. constructor mkTest
  7. field
  8. a b c : Nat
  9. f : Test -> Nat
  10. f (mkTest a b c) = a + b + c
  11. open Test
  12. g : Nat
  13. g = (f (mkTest 34 12 54)) + (f (record {a = 100; b = 120; c = 140})) + a m + b m + c m
  14. where m = mkTest 200 300 400
  15. main : IO Unit
  16. main = printNat g