I notice that in scalaz seven Monoid has multiply function, that is implemented by calling the replicate function.
Some questions on multiply functions:
1/ If I understand correctly, if I call 3 multiply(10), then append will be called 10 times. Is there a way to override the multiply implementation in the a class instance. For example, in the example 3 multiply(10), I would like to use integer multiplication instead of repetitively calling append ?
2/ Is there any reason why multiply is not defined in Semigroup. Is it because multiply must support 0 as the multiplication factor ? Similarly, I wonder if it is possible to make multiply to support negative number for Group ?
On Sat, Feb 25, 2012 at 3:29 PM, Anwar Rizal <anriza...@gmail.com> wrote: > Hi,
> I notice that in scalaz seven Monoid has multiply function, that is > implemented by calling the replicate function.
> Some questions on multiply functions:
> 1/ If I understand correctly, if I call 3 multiply(10), then append will be > called 10 times. Is there a way to override the multiply implementation in > the a class instance. For example, in the example 3 multiply(10), I would > like to use integer multiplication instead of repetitively calling append ?
> 2/ Is there any reason why multiply is not defined in Semigroup. Is it > because multiply must support 0 as the multiplication factor ? Similarly, I > wonder if it is possible to make multiply to support negative number for > Group ?
> Thanks, > Anwar .
> -- > You received this message because you are subscribed to the Google Groups > "scalaz" group. > To post to this group, send email to scalaz@googlegroups.com. > To unsubscribe from this group, send email to > scalaz+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/scalaz?hl=en.
> We should probably make it possible to override this function.
> On Sat, Feb 25, 2012 at 3:29 PM, Anwar Rizal <anriza...@gmail.com> wrote: > > Hi,
> > I notice that in scalaz seven Monoid has multiply function, that is > > implemented by calling the replicate function.
> > Some questions on multiply functions:
> > 1/ If I understand correctly, if I call 3 multiply(10), then append > will be > > called 10 times. Is there a way to override the multiply implementation > in > > the a class instance. For example, in the example 3 multiply(10), I > would > > like to use integer multiplication instead of repetitively calling > append ?
> > 2/ Is there any reason why multiply is not defined in Semigroup. Is it > > because multiply must support 0 as the multiplication factor ? > Similarly, I > > wonder if it is possible to make multiply to support negative number for > > Group ?
> > Thanks, > > Anwar .
> > -- > > You received this message because you are subscribed to the Google Groups > > "scalaz" group. > > To post to this group, send email to scalaz@googlegroups.com. > > To unsubscribe from this group, send email to > > scalaz+unsubscribe@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/scalaz?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "scalaz" group. > To post to this group, send email to scalaz@googlegroups.com. > To unsubscribe from this group, send email to > scalaz+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/scalaz?hl=en.
On Sun, Feb 26, 2012 at 11:11 AM, Jason Zaugg <jza...@gmail.com> wrote: > On Sun, Feb 26, 2012 at 10:06 AM, Anwar Rizal <anriza...@gmail.com> wrote: > > Yeah, I think so too.
> > I would love to have it at Semigroup (that accepts only positive > multiplier) > > and Group (that accepts also negative value).
> > Anwar.
> > On Sun, Feb 26, 2012 at 7:06 AM, Runar Bjarnason <runaror...@gmail.com> > > wrote:
> >> We should probably make it possible to override this function.
> That all sounds reasonable. We could make it return Option[A].
> -jason
> -- > You received this message because you are subscribed to the Google Groups > "scalaz" group. > To post to this group, send email to scalaz@googlegroups.com. > To unsubscribe from this group, send email to > scalaz+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/scalaz?hl=en.