~ubuntu-branches/ubuntu/wily/agda/wily-proposed

« back to all changes in this revision

Viewing changes to notes/records

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-08-05 06:38:12 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140805063812-io8e77niomivhd49
Tags: 2.4.0.2-1
* [6e140ac] Imported Upstream version 2.4.0.2
* [2049fc8] Update Build-Depends to match control
* [93dc4d4] Install the new primitives
* [e48f40f] Fix typo dev→doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
What do we want?
3
 
────────────────
4
 
 
5
 
∙ declaration syntax
6
 
    record Point : Set where
7
 
      x : Nat
8
 
      y : Nat
9
 
 
10
 
∙ constructor
11
 
    record { x = 4; y = 2 }
12
 
 
13
 
∙ projection functions
14
 
    dist = x p ^ 2 + y p ^ 2
15
 
 
16
 
∙ open
17
 
    open module P = Point p
18
 
    dist = sqrt (x ^ 2 + y ^ 2)
19
 
 
20
 
∙ η
21
 
  p ≡ record { x = x p; y = y p }
22
 
 
23
 
∙ pattern matching
24
 
    f (record { x = suc n }) = n
25
 
 
26
 
∙ record update syntax
27
 
    how?
28
 
    record p { x = zero } ?
29
 
 
30
 
Schedule
31
 
────────
32
 
 
33
 
First
34
 
  ∙ declaration systax
35
 
  ∙ constructor
36
 
  ∙ projection functions
37
 
  ∙ open
38
 
 
39
 
Next
40
 
  ∙ η
41
 
 
42
 
Later
43
 
  ∙ pattern matching
44
 
  ∙ update syntax
45
 
 
46
 
What does it mean?
47
 
──────────────────
48
 
 
49
 
data Point : Set where
50
 
  <Point> : (x : Nat)(y : Nat) -> Point
51
 
 
52
 
module Point (p : Point) where
53
 
  x : Nat
54
 
  x = <magic>
55
 
 
56
 
  y : Nat
57
 
  y = <magic>
58
 
 
59
 
Issues
60
 
──────
61
 
 
62
 
∙ mutual records? yes
63
 
  will it be a problem? probably not
64