Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-30 Thread Edward Kmett
Upon consideration from a package management perspective this is probably easiest done by building a new small package to provide the functionality you want. That way we don't haphazardly change the transitive dependencies of a big chunk of the ecosystem and it can rest atop the various containers

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-30 Thread Ryan Newton
so the simple O(1) split would produce three submaps, the middle one having only one element. This operation would not be very parallelization-friendly. Actually, I'm perfectly happy with that in this case! - A decent work-stealing system can tolerate a fairly large number of

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-30 Thread Ryan Newton
Edward, The problem is that I need *something* more from the containers library to be able to construct this as a separate library. I don't think I can use foldMap to implement a Splittable/Partitionable instance for Data.Set, namely because I specifically want to do O(1) work instead of any

[Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Ryan Newton
subject change On Sun, Sep 29, 2013 at 3:31 AM, Mike Izbicki m...@izbicki.me wrote: I've got a Partitionable class that I've been using for this purpose: https://github.com/mikeizbicki/ConstraintKinds/blob/master/src/Control/ConstraintKinds/Partitionable.hs Mike -- Neat, that's a cool

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Nicolas Trangez
I'd think partition :: t - Either t (t, t) might be more suited then... Nicolas On Sep 29, 2013 1:21 AM, Ryan Newton rrnew...@gmail.com wrote: subject change On Sun, Sep 29, 2013 at 3:31 AM, Mike Izbicki m...@izbicki.me wrote: I've got a Partitionable class that I've been using for this

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Milan Straka
Hi Ryan, -Original message- From: Ryan Newton rrnew...@gmail.com Sent: 29 Sep 2013, 04:21 snip *class Partitionable t where* * partition :: t - Maybe (t,t)* snip So what I really want is for the *containers package to please get some kind of Partitionable instances! * Johan

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Edward Kmett
I don't know that it belongs in the standard libraries, but there could definitely be a package for something similar. ConstraintKinds are a pretty hefty extension to throw at it, and the signature written there prevents it from being used on ByteString, Text, etc. This can be implemented with

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Ryan Newton
Thanks Edward. Good point about Brent's 'split' package. That would be a really nice place to put the class. But it doesn't currently depend on containers or vector so I suppose the other instances would need to go somewhere else. (Assuming containers only exported monomorphic versions.)

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Mike Izbicki
Besides just partition balance, the ordering of the resulting partitions is important. For example, the most efficient way to partition a list is by taking an every-other-n approach, whereas the most efficient way to partition a vector is by using a slice. (This, BTW, might be a good alternative

Re: [Haskell-cafe] Proposal: Partitionable goes somewhere + containers instances

2013-09-29 Thread Mario Blažević
On 09/29/13 08:20, Edward Kmett wrote: I don't know that it belongs in the standard libraries, but there could definitely be a package for something similar. ConstraintKinds are a pretty hefty extension to throw at it, and the signature written there prevents it from being used on ByteString,