Re: [Haskell-cafe] deriving instances of Enum for tuples of bounded, enumerable types (useful for generating QuickCheck.Arbitrary instances for collection of collection types)

2008-03-09 Thread Antoine Latter
On Sat, Mar 8, 2008 at 9:23 PM, Brandon S. Allbery KF8NH I think you might be able to do this as a typeclass instead, at the expense of having to insert an instance declaration for each type. (You will have to use an extension if you want to declare instances for types such as Int. I

Re: [Haskell-cafe] Exception handling when using STUArray

2008-03-09 Thread Donn Cave
On Mar 8, 2008, at 10:54 PM, Don Stewart wrote: [... replying to my poorly informed rant about exceptions ... ] I don't understand this complaint -- you can handle all these with Control.Exception. xmonad catches all these things for example, in user code, to prevent poorly written

Re: [Haskell-cafe] Exception handling when using STUArray

2008-03-09 Thread Don Stewart
donn: On Mar 8, 2008, at 10:54 PM, Don Stewart wrote: [... replying to my poorly informed rant about exceptions ... ] I don't understand this complaint -- you can handle all these with Control.Exception. xmonad catches all these things for example, in user code, to prevent poorly

[Haskell-cafe] simple Haskell question - List comprehensions

2008-03-09 Thread Philip Müller
Hi, I'm just working through Hutton's Programming in Haskell and I found an exercise which I can't solve, although it looks simple. Maybe someone here could give me a hint? Exercise: Show how the single comprehension [(x,y) | x - [1,2,3], y - [4,5,6]] with two generators can be re-expressed

Re: [Haskell-cafe] simple Haskell question - List comprehensions

2008-03-09 Thread Miguel Mitrofanov
Exercise: Show how the single comprehension [(x,y) | x - [1,2,3], y - [4,5,6]] with two generators can be re-expressed using two comprehensions with single generators. Hint: make use of the library function _concat_. Another hint: it can be rewritten as concatMap (\x - concatMap (\y -

Re: [Haskell-cafe] simple Haskell question - List comprehensions

2008-03-09 Thread Sebastian Sylvan
On Sun, Mar 9, 2008 at 7:27 PM, Philip Müller [EMAIL PROTECTED] wrote: Hi, I'm just working through Hutton's Programming in Haskell and I found an exercise which I can't solve, although it looks simple. Maybe someone here could give me a hint? Exercise: Show how the single comprehension

Re: [Haskell-cafe] Exception handling when using STUArray

2008-03-09 Thread Henning Thielemann
On Sat, 8 Mar 2008, Donn Cave wrote: On Mar 8, 2008, at 12:33 PM, Henning Thielemann wrote: On Sat, 8 Mar 2008, Denis Bueno wrote: ... I am also using STUArray from some time-critical code; however, I don't deal with ArrayException, or any exceptions for that matter. What besides an

[Haskell-cafe] Haskell Weekly News: March 09, 2008

2008-03-09 Thread Don Stewart
--- Haskell Weekly News http://sequence.complete.org/hwn/20080309 Issue 71 - March 09, 2008 --- Welcome to issue 71 of HWN, a newsletter covering

Re: [Haskell-cafe] STM example code

2008-03-09 Thread Adam Langley
2008/3/8 Galchin Vasili [EMAIL PROTECTED]: I am playing around with the STM API. I would like to see examples of STM other than the Santa.hs as I am having problems with STM vs IO. The STM papers were the best documentation for me:

[Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-09 Thread Krzysztof Skrzętnicki
Ok, I did some search and found Data.Map, which can be used to implement pretty fast sorting: import qualified Data.Map as Map treeSort :: Ord a = [a] - [a] treeSort = map (\(x,_) - x ) . Map.toAscList . Map.fromList . map (\x-(x,())) In fact It is likely to behave like sort, with the exception

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-09 Thread Dan Doel
On Sunday 09 March 2008, Krzysztof Skrzętnicki wrote: Ok, I did some search and found Data.Map, which can be used to implement pretty fast sorting: import qualified Data.Map as Map treeSort :: Ord a = [a] - [a] treeSort = map (\(x,_) - x ) . Map.toAscList . Map.fromList . map (\x-(x,()))

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-09 Thread Don Stewart
dan.doel: On Sunday 09 March 2008, Krzysztof Skrzętnicki wrote: Ok, I did some search and found Data.Map, which can be used to implement pretty fast sorting: import qualified Data.Map as Map treeSort :: Ord a = [a] - [a] treeSort = map (\(x,_) - x ) . Map.toAscList . Map.fromList .

Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families

2008-03-09 Thread Manuel M T Chakravarty
Hugo Pacheco: If the equality does not hold, you should get a type error because your program is not type correct. So, what is it that you would like different? I would simply like the compiler not to use that instance if the equality constraint does not hold, like some another instance

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-09 Thread Duncan Coutts
On Sun, 2008-03-09 at 23:04 -0400, Dan Doel wrote: On Sunday 09 March 2008, Krzysztof Skrzętnicki wrote: What do you think about this particular function? Some thoughts: 1) To get your function specifically, you could just use Data.Set.Set a instead of Map a (). 2) What does it do