blob: 1b4ba426aae535800040f037fa31cf471935ebbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
-- Trac #3590: a bug in typechecking of sections
module T3590 where
newtype ListT m a =
ListT { runListT :: m (Maybe (a, ListT m a)) }
class Monad (ItemM l) => List l where
type ItemM l :: * -> *
joinL :: [ItemM l (l a) -> l a]
instance Monad m => List (ListT m) where
type ItemM (ListT m) = m
joinL = [ ListT . (>>= runListT) -- Right section
, ListT . (runListT <<=) -- Left section
]
(<<=) :: Monad m => (a -> m b) -> m a -> m b
(<<=) k m = m >>= k
|