[Haskell-beginners] Get things from IO monad

Antoine Latter aslatter at gmail.com
Fri May 6 05:22:34 CEST 2011


On Thu, May 5, 2011 at 5:48 PM,  <jianqiuchi at gmail.com> wrote:
> Hi,
>
> I have a silly question, Can i get things out of IO monad?
>
> for example, function 'anotherFun' doesn't work.
>
> genFunc :: IO String
>
> anotherFunc :: (Monad m) => m String
> -- m is a complex monad and is not an IO monad
> -- m is not an instance of MonadIO so liftIO will not work
> anotherFunc = do
> genStr <- genFunc
> return genStr
>
>
> I just want to get something from IO monad and wrap it with some other
> monad. Is there anyway to do that? Thanks.

Not being able to do that is the entire point of the IO monad.

What are you trying to do?

Antoine


> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



More information about the Beginners mailing list