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

« back to all changes in this revision

Viewing changes to test/fail/MagicWith.agda

  • 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
 
module MagicWith where
3
 
 
4
 
data _×_ (A : Set)(B : A -> Set) : Set where
5
 
  _,_ : (x : A) -> B x -> A × B
6
 
 
7
 
fst : {A : Set}{B : A -> Set} -> A × B -> A
8
 
fst (x , y) = x
9
 
 
10
 
snd : {A : Set}{B : A -> Set}(p : A × B) -> B (fst p)
11
 
snd (x , y) = y
12
 
 
13
 
data Nat : Set where
14
 
  zero : Nat
15
 
  suc  : Nat -> Nat
16
 
 
17
 
record True  : Set where
18
 
data   False : Set where
19
 
 
20
 
IsZero : Nat -> Set
21
 
IsZero zero    = True
22
 
IsZero (suc _) = False
23
 
 
24
 
Uncurry : {A : Set}{B : A -> Set} -> ((x : A) -> B x -> Set) -> A × B -> Set
25
 
Uncurry F p = F (fst p) (snd p)
26
 
 
27
 
F : (n : Nat) -> IsZero n -> Set
28
 
F zero _ = True
29
 
F (suc _) ()
30
 
 
31
 
f : (p : Nat × IsZero) -> Uncurry F p
32
 
f p with fst p
33
 
f p | zero  = _
34
 
f p | suc _ = ?
35