On Fri, 15 Oct 2004 19:55:02 -0400 Andrew Pimlott <[EMAIL PROTECTED]> wrote:
> data Foo = forall t. (MonadTrans t) => Foo > ((Monad m, Monad (t m)) => t m a -> m a) -- run > ((Monad m, Monad (t m)) => t m Int) -- op > > prog :: Foo -> IO Int > prog (Foo run op) = run $ do > lift $ putStrLn "Running prog" > op > > ghci gives the error > > Could not deduce (Monad (t IO)) from the context (MonadTrans t) > arising from use of `op' at try.hs:22 Your prog leaks m (= IO) out of Foo. I guess you mean: > data Foo m = forall t. (MonadTrans t, Monad (t m)) => > Foo (forall a. t m a -> m a) (t m Int) > > prog :: Foo IO -> IO Int > prog (Foo run op) = run $ do > lift $ putStrLn "Running prog" > op > > test = prog (Foo (flip evalStateT 0) get) -- Koji Nakahara _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
