[Haskell-beginners] Get things from IO monad
Daniel Fischer
daniel.is.fischer at googlemail.com
Fri May 6 09:46:39 CEST 2011
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.
More information about the Beginners
mailing list