Mercurial > hg > Members > atton > delta_monad
comparison agda/similar.agda @ 26:5ba82f107a95
Define Similar in Agda
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 07 Oct 2014 14:43:33 +0900 |
parents | |
children | 742e62fc63e4 |
comparison
equal
deleted
inserted
replaced
25:a5aadebc084d | 26:5ba82f107a95 |
---|---|
1 open import list | |
2 | |
3 module similar where | |
4 | |
5 postulate String : Set | |
6 postulate show : {A : Set} -> A -> String | |
7 | |
8 data Similar (A : Set) : Set where | |
9 similar : List String -> A -> List String -> A -> Similar A | |
10 | |
11 | |
12 fmap : {A B : Set} -> (A -> B) -> (Similar A) -> (Similar B) | |
13 fmap f (similar xs x ys y) = similar xs (f x) ys (f y) | |
14 | |
15 | |
16 mu : {A : Set} -> Similar (Similar A) -> Similar A | |
17 mu (similar lx (similar llx x _ _) ly (similar _ _ lly y)) = similar (lx ++ llx) x (ly ++ lly) y | |
18 | |
19 returnS : {A : Set} -> A -> Similar A | |
20 returnS x = similar [[ (show x) ]] x [[ (show x) ]] x | |
21 | |
22 returnSS : {A : Set} -> A -> A -> Similar A | |
23 returnSS x y = similar [[ (show x) ]] x [[ (show y) ]] y | |
24 | |
25 |