summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--events/src/Events/Types/NDT.hs21
1 files changed, 0 insertions, 21 deletions
diff --git a/events/src/Events/Types/NDT.hs b/events/src/Events/Types/NDT.hs
index 3f66953..f6d3000 100644
--- a/events/src/Events/Types/NDT.hs
+++ b/events/src/Events/Types/NDT.hs
@@ -31,10 +31,6 @@ data NDT m a where
31 NDTBind :: NDT m a -> (a -> NDT m b) -> NDT m b 31 NDTBind :: NDT m a -> (a -> NDT m b) -> NDT m b
32 NDTCons :: m (Maybe (a, NDT m a)) -> NDT m a 32 NDTCons :: m (Maybe (a, NDT m a)) -> NDT m a
33 33
34instance Show (NDT Identity a) where
35 show (NDTBind x _) = "Bind (" ++ show x ++ ") _"
36 show x = show . (\(NDTCons x) -> x) $ fmap (const ()) x
37
38instance Functor m => Functor (NDT m) where 34instance Functor m => Functor (NDT m) where
39 fmap f (NDTBind a g) = NDTBind a (fmap f . g) 35 fmap f (NDTBind a g) = NDTBind a (fmap f . g)
40 fmap f (NDTCons x) = NDTCons $ fmap f' x 36 fmap f (NDTCons x) = NDTCons $ fmap f' x
@@ -73,23 +69,6 @@ instance MonadReader r m => MonadReader r (NDT m) where
73 local f (NDTCons x) = NDTCons (local f x) 69 local f (NDTCons x) = NDTCons (local f x)
74 local f (NDTBind x g) = NDTBind (local f x) g 70 local f (NDTBind x g) = NDTBind (local f x) g
75 71
76-- instance MonadFix m => MonadFix (NDT m) where
77-- mfix f = NDTCons . runMaybeT $ do
78-- x <- mfix (head . f)
79-- return (x, trace "tail" . mfix $ tail . f)
80-- where
81-- head :: Monad m => NDT m a -> MaybeT m a
82-- head (NDTCons x) = MaybeT . trace "head (cons)" $ fmap fst <$> x
83-- head (NDTBind (NDTBind x g) f) = head $ NDTBind x (f <=< g)
84-- head (NDTBind (NDTCons x) f) = MaybeT x >>= head . f . fst . trace "head (bind cons)"
85-- tail :: Monad m => NDT m a -> NDT m a
86-- tail (NDTCons x) = NDTBind (lift x) $ maybe empty snd . guardNothing
87-- tail (NDTBind (NDTBind x g) f) = tail $ NDTBind x (f <=< g)
88-- tail (NDTBind (NDTCons x) f) = tail . NDTCons $ fmap (\(_, xs) -> (undefined, NDTBind xs f)) <$> x
89-- guardNothing :: Maybe a -> Maybe a
90-- guardNothing x@(Just _) = x
91-- guardNothing x@(Nothing) = trace "Nothing" x
92
93instance MonadIO m => MonadIO (NDT m) where 72instance MonadIO m => MonadIO (NDT m) where
94 liftIO = lift . liftIO 73 liftIO = lift . liftIO
95 74