Two questions on Reducer

58 views
Skip to first unread message

Ben Hutchison

unread,
Mar 29, 2015, 6:18:50 PM3/29/15
to sca...@googlegroups.com
1. I noticed there isn't a Reducer for Set, although one exists in the source Haskell library. Send a PR?

2. The Reducer typeclass seem a little inconsistent to others, eg Monoid/Monad, in that it's declared sealed, and a constructor provided. Any reason for this beyond "historical accident"?

-Ben

Stephen Compall

unread,
May 28, 2015, 1:26:39 AM5/28/15
to sca...@googlegroups.com
On Mon, 2015-03-30 at 09:18 +1100, Ben Hutchison wrote:
1. I noticed there isn't a Reducer for Set, although one exists in the source Haskell library. Send a PR?
[http://hackage.haskell.org/package/monoids-0.2.0/docs/src/Data-Monoid-Reducer.html]

Sure.



2. The Reducer typeclass seem a little inconsistent to others, eg Monoid/Monad, in that it's declared sealed, and a constructor provided. Any reason for this beyond "historical accident"?
[https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Reducer.scala#L154]

It's kind of in a middle area; I hesitate to call it a "typeclass" at all, despite the presence and use of implicits for it. It has straightforward laws, but seems more amenable to first-class manipulation and resistant to coherence complaints than typeclasses in general.
-- 
Stephen Compall
"^aCollection allSatisfy: [:each|aCondition]": less is better
signature.asc

Ken Scambler

unread,
May 28, 2015, 1:33:16 AM5/28/15
to sca...@googlegroups.com
A bit off topic, but what makes something amenable for typeclass vs first-class usage?  I hear some grumbling in Haskell about typeclasses being a special separate thing with worse tools of abstraction, but on the Scala side where the instances are tangible objects, I hear stern warnings to clearly demarcate the two usages.

I find myself a bit short of intuition on the matter.

Cheers,
Ken

--
You received this message because you are subscribed to the Google Groups "scalaz" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaz+un...@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
Visit this group at http://groups.google.com/group/scalaz.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages