Mercurial > hg > Members > atton > delta_monad
view 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 |
line wrap: on
line source
open import list module similar where postulate String : Set postulate show : {A : Set} -> A -> String data Similar (A : Set) : Set where similar : List String -> A -> List String -> A -> Similar A fmap : {A B : Set} -> (A -> B) -> (Similar A) -> (Similar B) fmap f (similar xs x ys y) = similar xs (f x) ys (f y) mu : {A : Set} -> Similar (Similar A) -> Similar A mu (similar lx (similar llx x _ _) ly (similar _ _ lly y)) = similar (lx ++ llx) x (ly ++ lly) y returnS : {A : Set} -> A -> Similar A returnS x = similar [[ (show x) ]] x [[ (show x) ]] x returnSS : {A : Set} -> A -> A -> Similar A returnSS x y = similar [[ (show x) ]] x [[ (show y) ]] y