Mercurial > hg > Members > atton > delta_monad
comparison similer.hs @ 1:878d1e271709
Force Implement mu
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Aug 2014 18:35:10 +0900 |
parents | 7a82a5e50499 |
children | a5210ec1e41b |
comparison
equal
deleted
inserted
replaced
0:7a82a5e50499 | 1:878d1e271709 |
---|---|
1 {-# LANGUAGE FlexibleContexts #-} | |
1 data Similer a f b = Similer a (a -> b) b | 2 data Similer a f b = Similer a (a -> b) b |
2 | 3 |
3 instance Functor (Similer a f) where | 4 instance Functor (Similer a f) where |
4 fmap g (Similer a f b) = Similer a (g . f) $ g b | 5 fmap g (Similer a f b) = Similer a (g . f) $ g b |
5 | 6 |
6 eta :: a -> Similer a (a -> a) a | 7 eta :: a -> Similer a (a -> a) a |
7 eta a = Similer a id a | 8 eta a = Similer a id a |
8 | 9 |
9 --mu :: (Eq a, Eq b, Eq c) => Similer a (a -> b) (Similer b (b -> c) c) -> Similer b (b -> c) c | 10 --mu :: (Eq (Similer b (b -> c) c)) => Similer a (a -> (Similer b (b -> c) c)) (Similer b (b -> c) c) -> Similer b (b -> c) c |
10 --mu (Similer a f (Similer b g c)) = if ((f a) == b) then Similer b g c else undefined | 11 mu :: (Eq (Similer b (b -> c) c)) => Similer a (a -> (Similer b (b -> c) c)) (Similer b (b -> c) c) -> Similer b (b -> c) c |
11 --mu (Similer a f (Similer b g c)) = if ((f a) == b) then Similer b g c else undefined | 12 mu (Similer a f b) = if ((f a) == b) then b else undefined |