[Haskell-beginners] Get things from IO monad

jianqiuchi at gmail.com jianqiuchi at gmail.com
Fri May 6 12:17:12 CEST 2011


Thanks guys, I thinks I can stop trying to get things out of IO now.  
Instead I should see if I could make my monad as an instance of MonadIO, so  
I can use liftIO, which should be safe I believe.

2011-5-6下午3:46,Daniel Fischer <daniel.is.fischer at googlemail.com>撰写:
> On Friday 06 May 2011 05:28:35, Felipe Almeida Lessa wrote:

> > If you are a beginner, you should never use anything that starts with

> > 'unsafe'.



> Basically yes, use something beginning with 'unsafe' only when you know  
> why

> it's not unsafe in your specific case.



> But of course there are different levels of unsafeness,

> Data.Array.Base.unsafeAt for example is relatively benign (same as in  
> other

> languages: if you don't let the compiler check array bounds and screw your

> check up, you can get nonsense or segfaults, but it's relatively easy to

> understand and control).



> > And you should never use 'unsafePerformIO'. And you

> > should NEVER use 'unsafeCoerce'.



> Those two indeed have a different calibre, use them only

> whenYouReallyKnowWhatYouAreDoing.



> They have their uses and sometimes are the right thing, but like goto, in

> most cases one is tempted to use them, one shouldn't.



> >

> > Cheers, =)

> >

> > --

> > Felipe.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110506/3c219fbe/attachment.htm>


More information about the Beginners mailing list