module Data.Thrist.List ( List(..) ) where
import Data.Thrist
import Control.Monad ()
import Control.Applicative (Applicative(..))
data List :: * -> * -> * where
El :: a -> List a a
newtype List' a = List' (Thrist List a a)
instance Functor List' where
fmap _ (List' Nil) = List' Nil
fmap f (List' (Cons (El a) as)) = List' $ Cons (El $ f a) (unlist' . fmap f $ List' as)
where unlist' (List' l) = l
instance Applicative List' where
pure = return
(<*>) = undefined
instance Monad List' where
return a = List' $ Cons (El a) Nil
List' a >>= f = undefined