Mercurial > hg > Members > atton > similar_monad
changeset 0:7a82a5e50499
Initial commit. define to Functor for Similer
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Aug 2014 16:48:45 +0900 |
parents | |
children | 878d1e271709 |
files | similer.hs |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/similer.hs Sun Aug 31 16:48:45 2014 +0900 @@ -0,0 +1,11 @@ +data Similer a f b = Similer a (a -> b) b + +instance Functor (Similer a f) where + fmap g (Similer a f b) = Similer a (g . f) $ g b + +eta :: a -> Similer a (a -> a) a +eta a = Similer a id a + +--mu :: (Eq a, Eq b, Eq c) => Similer a (a -> b) (Similer b (b -> c) c) -> Similer b (b -> c) c +--mu (Similer a f (Similer b g c)) = if ((f a) == b) then Similer b g c else undefined +--mu (Similer a f (Similer b g c)) = if ((f a) == b) then Similer b g c else undefined