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

« back to all changes in this revision

Viewing changes to test/epic/tests/Mutual.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
 
module tests.Mutual where
2
 
 
3
 
open import Prelude.IO
4
 
open import Prelude.String
5
 
open import Prelude.Unit
6
 
 
7
 
mutual
8
 
  data G : Set where
9
 
    GA : {g : G}(f : F g) -> G
10
 
    GB : G
11
 
 
12
 
  data F : G -> Set where
13
 
    FA : (g : G) -> F g
14
 
    FB : F GB
15
 
 
16
 
mutual
17
 
  incG : G -> G
18
 
  incG GB     = GA FB
19
 
  incG (GA f) = GA (incF f)
20
 
 
21
 
  incF : {g : G} -> F g -> F (incG g)
22
 
  incF FB     = FA (GA FB)
23
 
  incF (FA g) = FA (incG g)
24
 
  
25
 
 
26
 
 
27
 
 
28
 
mutual
29
 
  PrintF : {g : G} -> F g -> String
30
 
  PrintF FB = "FB"
31
 
  PrintF (FA g) = "(FA " +S+ PrintG g +S+ ")"
32
 
  
33
 
  PrintG : G -> String
34
 
  PrintG GB     = "GB"
35
 
  PrintG (GA f) = "(GA " +S+ PrintF f +S+ ")"
36
 
  
37
 
main : IO Unit
38
 
main =
39
 
    putStrLn (PrintF (FA (GA (FA GB)))) ,,
40
 
    putStrLn (PrintG (incG (GA (incF FB)))) ,, -- 
41
 
    return unit
 
 
b'\\ No newline at end of file'