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

« back to all changes in this revision

Viewing changes to test/succeed/DataPolarity.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
 
{-# OPTIONS -v tc.polarity.set:10 #-}
2
 
 
3
 
{-# OPTIONS --sized-types #-}
4
 
module DataPolarity where
5
 
 
6
 
open import Common.Size
7
 
 
8
 
data Nat : {size : Size} -> Set where
9
 
  zero : {size : Size} -> Nat {↑ size}
10
 
  suc  : {size : Size} -> Nat {size} -> Nat {↑ size}
11
 
 
12
 
data Pair (A : Set) : Set where
13
 
  _,_ : A -> A -> Pair A
14
 
 
15
 
split : {i : Size} → Nat {i} → Pair (Nat {i})
16
 
split zero = zero , zero
17
 
split (suc n) with split n
18
 
... | (l , r) = suc r , l
19
 
 
20
 
MyPair : Nat → Set → Set
21
 
MyPair zero A = Pair A
22
 
MyPair (suc n) A = MyPair n A
23
 
 
24
 
mysplit : {i : Size} → (n : Nat {i}) → MyPair (suc zero) (Nat {i})
25
 
mysplit zero = zero , zero
26
 
mysplit (suc n) with mysplit n
27
 
... | (l , r) = suc r , l