[Haskell] help -- need a random number
Marc A. Ziegert
coeus at gmx.de
Thu Apr 26 15:06:10 EDT 2007
that is exact the way, how i had learned about the state monads like IO and Maybe.
that was even before i understood the [] monad, folding and using Random; i don't remember when that was... ghc-5.xx age.
in my opinion, unsafePerformIO is a good learning tool, as soon as you use it tricky to analyze and discover "new worlds you have never been before".
like this:
blah = unsafePerformIO $ do
putStrLn "I'm here: blah!"
return blub
this way, it may be even more important than undefined:
undef s = unsafePerformIO $ do
putStrLn "whops, this shouldn't happen"
putStrLn s
return undefined
well, this is my unpure way of learning to think in new languages.
i used ways like this in c++ to analyze OOP and to discover the world before and after int main().
greetings
- marc
Am Donnerstag, 26. April 2007 20:15 schrieb Johannes Waldmann:
>
> > import System.IO.Unsafe (unsafePerformIO,unsafeInterleaveIO)
>
> Whoa! I'd be very cautious recommending these for newbies ...
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell/attachments/20070426/22141dba/attachment.bin
More information about the Haskell
mailing list