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

2009-02-07 Thread Kalman Noel
As I didn't catch the whole thread, I hope I'm not just repeating everyone else: Roel van Dijk wrote: I guess what unsafe should mean is a matter of taste. Personally I find correctness more important that pureness. An unsafe function will crash your program if evaluated when its

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

2009-02-06 Thread Roel van Dijk
On Fri, Feb 6, 2009 at 1:00 PM, Antoine Latter aslat...@gmail.com wrote: Tangential to all of this - sometimes my unsafeXXX functions are pure, but partial.  So I'll have: foo :: a - b - Maybe c and unsafeFoo :: a - b - c I use the unsafe prefix in the same way. For me it means 'assume

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

2009-02-06 Thread Colin Paul Adams
Roel == Roel van Dijk vandijk.r...@gmail.com writes: Roel On Fri, Feb 6, 2009 at 1:00 PM, Antoine Latter aslat...@gmail.com wrote: Tangential to all of this - sometimes my unsafeXXX functions are pure, but partial.  So I'll have: foo :: a - b - Maybe c and

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

2009-02-06 Thread Antoine Latter
On Thu, Feb 5, 2009 at 3:11 PM, Andrew Wagner wagner.and...@gmail.com 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

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

2009-02-06 Thread Roel van Dijk
Do you document the preconditions? Yes. The 'safe' variants of those functions have all preconditions listed in the accompanying (haddock) comments. The 'unsafe' variants simply state that they promote exceptions to errors. It seems to me that this is more useful than naming a function

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

2009-02-06 Thread Roel van Dijk
On Fri, Feb 6, 2009 at 5:22 PM, Alberto G. Corona agocor...@gmail.com wrote: then Data.List.head   Data.Maybe.fromMaybe etc are also unsafe?. Yes, I consider them unsafe. Whenever I see those functions I know that I have to look elsewhere to see if their preconditions hold. I would have preferred

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

2009-02-06 Thread Alberto G. Corona
Then you are talking about something very different from the subject that Andrew started.. He clearly ask about unsafeXXX understood as impurity which defiles our ability to reason logically about haskell programs like we would like to. I also want to discuss here that any signature of type IO a

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

2009-02-05 Thread Thomas Davie
On 5 Feb 2009, at 22:11, 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 haskell