Unboxed collections and typeclasses

9 views
Skip to first unread message

Arthur Chan

unread,
Nov 8, 2012, 2:54:58 PM11/8/12
to baha...@googlegroups.com
Hi All,

I was looking at unboxed collections like the ones in Data.Vector and Data.Array, and I realized that there is no typeclass abstracting over them. I was wondering if there were any particular challenges that would preclude defining one. Vector and Array both seem to have their own idea of what "Unbox"ed means, and they seem similar. Repa seems to have one of its own. Maybe it would be possible to define a foldable/traversable typeclass with strict functions, that is automatically defined on any non-strict foldable/traversable?

best,
Arthur

Max Cantor

unread,
Nov 8, 2012, 4:46:26 PM11/8/12
to baha...@googlegroups.com
One challenge is that tekmo will eat your soul on reddit/r/haskell.  

(see also: classy-prelude)


--
You received this message because you are subscribed to the Google Groups "Bay Area Haskell Users Group" group.
To post to this group, send email to baha...@googlegroups.com.
To unsubscribe from this group, send email to bahaskell+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/bahaskell/-/Wufh6YFiFt4J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Arthur Chan

unread,
Nov 8, 2012, 7:59:32 PM11/8/12
to baha...@googlegroups.com, baha...@googlegroups.com
Well... I figured that it was a naive and stupid question, but I didn't know it was *that* stupid.

Arthur :: LittleBrick

Arthur Chan

unread,
Nov 8, 2012, 8:05:26 PM11/8/12
to baha...@googlegroups.com
Ok, I'm going to just admit sheer ignorance here, at the risk of being laughed at by every haskeller in the bay area, because I'm looking at classy-prelude and it seems reasonable. What's so bad about using a typeclass to traverse over unboxed vectors?

Arthur Chan

unread,
Nov 8, 2012, 8:09:52 PM11/8/12
to baha...@googlegroups.com
Hmm, hang on, there's more than one "classy prelude."

Zaki Manian

unread,
Nov 8, 2012, 8:31:25 PM11/8/12
to baha...@googlegroups.com

Myles C. Maxfield

unread,
Nov 8, 2012, 8:52:05 PM11/8/12
to baha...@googlegroups.com
Wow.

Johan Tibell

unread,
Nov 8, 2012, 8:55:16 PM11/8/12
to baha...@googlegroups.com
On Thu, Nov 8, 2012 at 5:31 PM, Zaki Manian <zma...@gmail.com> wrote:
From an engineering perspective I simply don't think the costs outweigh the benefits.

-- Johan
 

Arthur Chan

unread,
Nov 8, 2012, 9:18:54 PM11/8/12
to baha...@googlegroups.com
yea forget about what I said about classy-prelude being reasonable.

--

Evan Laforge

unread,
Nov 8, 2012, 11:40:09 PM11/8/12
to baha...@googlegroups.com
I used to be on the side of not seeing what the point of generic
containers is. But then I needed a bunch of functions to work on both
boxed and unboxed vectors, and if it weren't for Data.Vector.Generic I
would have had to duplicate code. So I can see how it's useful to
abstract over vectors.

Maybe you could write instances for Data.Vector.Generic and make it
work with other vector libraries?

But a better idea is probably to use Data.Vector, and forget about Data.Array :)

On Thu, Nov 8, 2012 at 5:55 PM, Johan Tibell <johan....@gmail.com> wrote:

Johan Tibell

unread,
Nov 8, 2012, 11:52:59 PM11/8/12
to baha...@googlegroups.com
On Thu, Nov 8, 2012 at 8:40 PM, Evan Laforge <qdu...@gmail.com> wrote:
But a better idea is probably to use Data.Vector, and forget about Data.Array :)

Given that Vector is just a better Array, I would do just that. Now, that doesn't mean that there might be a vector type in the future that we might want to abstract over. 
Reply all
Reply to author
Forward
0 new messages