1 class NewFunctor f where
2 new_fmap :: (a -> b) -> f a -> f b
4 data N a = Z a | S (N a)
7 nmap f (S n) = S (nmap f n)
12 instance NewFunctor N where
15 --class Strange f where
21 --class FMonad m where
22 -- (>>=) :: m a -> (a -> m b) -> m b
23 -- (>>) :: m a -> m b -> m b
25 -- fail :: String -> m a
27 -- m >> k = m >>= \_ -> k
39 twice :: NewFunctor f => (a -> a) -> f a -> f a
40 twice f x = new_fmap f (new_fmap f x)
42 main = putStr (tag (nmap (\x -> x) (Z "hello world\n")))
43 --main = putStr (tag (nmap (\x -> x) (Z "hello world\n")))
44 -- main = putStr (tag {- (twice (\x -> x) -} (Z "hello world\n"))