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

« back to all changes in this revision

Viewing changes to test/fail/CopatternNonterminating.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 --copatterns #-}
2
 
module CopatternNonterminating where
3
 
 
4
 
open import Common.Equality
5
 
 
6
 
record Stream (A : Set) : Set where
7
 
  coinductive
8
 
  field
9
 
    head : A
10
 
    tail : Stream A
11
 
module S = Stream
12
 
 
13
 
illdefined : {A : Set} -> Stream A
14
 
S.head illdefined = S.head illdefined
15
 
S.tail illdefined = S.tail illdefined
16
 
 
17
 
{-
18
 
illRepeat : {A : Set}(a : A) → Stream A
19
 
(       (S.head (illRepeat a))) = a
20
 
(S.head (S.tail (illRepeat a))) = a
21
 
(S.tail (S.tail (illRepeat a))) = S.tail (S.tail (illRepeat a))
22
 
-}
23
 
 
24
 
{-
25
 
illRepeat : {A : Set}(a : A) → Stream A
26
 
(       (S.head (illRepeat a))) = a
27
 
(S.head (S.tail (illRepeat a))) = a
28
 
(S.tail (S.tail (illRepeat a))) = (S.tail (illRepeat a))
29
 
 
30
 
record _≈_ {A : Set}(s t : Stream A) : Set where
31
 
  field
32
 
    head : S.head s ≡ S.head t
33
 
    tail : S.tail s ≈ S.tail t
34
 
module B = _≈_
35
 
 
36
 
repeat : {A : Set}(a : A) → Stream A
37
 
S.head (repeat a) = a
38
 
S.tail (repeat a) = repeat a
39
 
 
40
 
repeat′ : {A : Set}(a : A) → Stream A
41
 
(       (S.head (repeat′ a))) = a
42
 
(S.head (S.tail (repeat′ a))) = a
43
 
(S.tail (S.tail (repeat′ a))) = S.tail (repeat′ a) -- invalid projection
44
 
 
45
 
repeat≈repeat′ : {A : Set}(a : A) → repeat a ≈ repeat′ a
46
 
(       (B.head (repeat≈repeat′ a))) = refl
47
 
(B.head (B.tail (repeat≈repeat′ a))) = refl
48
 
(B.tail (B.tail (repeat≈repeat′ a))) = repeat≈repeat′ a
49
 
-}