Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-08 Thread Yitzchak Gale
Peter Verswyvelen wrote: I do have asked myself the question whether a really random generating function could be regarded as pure somehow I wrote: Not really... Alberto G. Corona wrote: What is pure randomness? .When the algorithmic complexity of the list of random number is equal to the

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-07 Thread Yitzchak Gale
Peter Verswyvelen wrote: I do have asked myself the question whether a really random generating function could be regarded as pure somehow Not really. Somewhere in your program you are likely to make the assumption that a value you obtained, however indirectly, from this function will be the

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-06 Thread Edsko de Vries
Hi, My opinion is that unsafeXXX is acceptable only when its use is preserved behind an abstraction that is referentially transparent and type safe. Others may be able to help refine this statement. I would agree with this. The problem is that impurity spreads easily. For example, suppose we

[Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Andrew Wagner
So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about haskell programs like we would like to. My question is, to what

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 16:11 -0500, Andrew Wagner wrote: So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew Wagner wrote: | I understand that unsafeXXX allows impurity, which defiles our ability | to reason logically about haskell programs like we would like to. My | question is, to what extent is this true? My opinion is that unsafeXXX is

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
I do have asked myself the question whether a really random generating function could be regarded as pure somehow (actually would a true random function still be a mathematical function?) E.g. the function would return a true (not pseudo) random number, practically unpredictable (e.g. hardware

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Max Rabkin
2009/2/5 Peter Verswyvelen bugf...@gmail.com: Of course you could just put this random generator in the IO monad, but certain algorithms- like Monte Carlo - intuitively don't seem to operate in a IO monad to me. For PRNGs, only State is needed, not IO. But you might find the `randoms'

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Verswyvelen wrote: | I do have asked myself the question whether a really random generating | function could be regarded as pure somehow (actually would a true | random function still be a mathematical function?) | | E.g. the function would

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
Well, one could say that a truly random number function takes as input time and some constant unique identifier (serial number) of the TRND device and gives you the random value measured at that time by this device. Of course this would mean the random value is not really random, since the