Mercurial > hg > Members > atton > similar_monad
changeset 5:051c663a4af2
Rename some functions
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Sep 2014 11:02:00 +0900 |
parents | 66609010d477 |
children | 5e367a167382 |
files | similer.hs |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/similer.hs Tue Sep 02 11:01:25 2014 +0900 +++ b/similer.hs Tue Sep 02 11:02:00 2014 +0900 @@ -4,14 +4,14 @@ instance Functor (Similer a) where fmap g (Similer a f b) = Similer a (g . f) $ g b -same :: (Eq a) => Similer a b -> Similer a b -> Bool -same (Similer a _ _ ) (Similer b _ _) = a == b +eq :: (Eq a) => Similer a b -> Similer a b -> Bool +eq (Similer a _ _ ) (Similer b _ _) = a == b eta :: a -> Similer a a eta a = Similer a id a mu :: (Eq b) => Similer a (Similer b c) -> Similer b c -mu (Similer a f b) = if (same (f a) b) then b else undefined +mu (Similer a f b) = if (eq (f a) b) then b else undefined double :: Int -> Similer Int Int double x = Similer (2 * x) id (2 * x) @@ -22,5 +22,5 @@ plusTwo :: Int -> Similer Int (Similer Int Int) plusTwo x = Similer x double (Similer (x + 2) id (x + 2)) -hoge :: Eq b => Similer a b -> b -hoge (Similer x f y) = if (f x) == y then y else undefined +same :: Eq b => Similer a b -> b +same (Similer x f y) = if (f x) == y then y else undefined