Re: Help needed with compilation error

Andrew Phillips <[email protected]> Sat, 22 Oct 2016 13:07:09 -0700 (PDT)
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>
------=_Part_755_498969717.1477166829969
Content-Type: multipart/alternative; 
	boundary="----=_Part_756_1514042039.1477166829969"

------=_Part_756_1514042039.1477166829969
Content-Type: text/plain; charset=UTF-8

Hi Abdul

I suspect this may be more of a question for scala-user, but from a quick 
look, and without much investigation, it seems the problem is that the 
compiler interprets the expression accumulate[T, O, O](a => a)(to) as if 
you were trying to pass explicit arguments for the implicit parameters of 
the method accumulate. The method takes *two* implicit parameters, but the 
first argument list we are providing contains only one (a => a), so the 
compiler complains.

The following variants, which help the compiler understand that we are 
*first* trying to "create a version" of the accumulate method with the type 
parameters bound to T, O and O, *then* apply the arguments "a => a" and 
"to" to it, both work for me:

scala>   def reduce[T[_]: Traversable, O: Monoid]: T[O] => O = to => {
     |     val accumulateFun: (O => O) => T[O] => O = accumulate _
     |     accumulateFun(a => a)(to)
     |   }
warning: there was one feature warning; re-run with -feature for details
reduce: [T[_], O](implicit evidence$1: Traversable[T], implicit evidence$2: 
Mono
id[O])T[O] => O

scala>   def reduce[T[_]: Traversable, O: Monoid]: T[O] => O = to => 
accumulate[
T, O, O].apply(a => a)(to)
warning: there was one feature warning; re-run with -feature for details
reduce: [T[_], O](implicit evidence$1: Traversable[T], implicit evidence$2: 
Mono
id[O])T[O] => O

Note that both variants result in a warning on 2.11.6:

<console>:10: warning: higher-kinded type should be enabled
by making the implicit value scala.language.higherKinds visible.
This can be achieved by adding the import clause 'import 
scala.language.higherKi
nds'
or by setting the compiler option -language:higherKinds.
See the Scala docs for value scala.language.higherKinds for a discussion
why the feature should be explicitly enabled.

See http://scalapuzzlers.com/#pzzlr-044 for a related code sample.

Regards

ap


On Saturday, 22 October 2016 15:31:24 UTC-4, 

Abdul Rahman Sattar wrote:
>
> Hi, 
>
> up vote
> down votefavorite 
> <http://stackoverflow.com/questions/40195799/what-is-wrong-with-the-method-definition#>
>
> Below are my method signatures and definitions in scala
>
>   def accumulate[T[_]: Traversable, O: Monoid, A]: (A => O) => T[A] => O =
>     fao => ta =>
>       (implicitly[Traversable[T]].traverse[({type f[X] = Acc[O, X]})#f, A, O](ta)(a => Acc(fao(a)))).value
>
>   def reduce[T[_]: Traversable, O: Monoid]: T[O] => O = to => accumulate[T, O, O](a => a)(to)
>
> However I get the following error for my definition of reduce
>
> Error:(160, 82) not enough arguments for method accumulate: (implicit evidence$7: Traversable[T], implicit evidence$8: Monoid[O])(O => O) => (T[O] => O).Unspecified value parameter evidence$8.
>   def reduce[T[_]: Traversable, O: Monoid]: T[O] => O = to => accumulate[T, O, O](a => a)(to)
>                                                                                  ^
>
> Not sure where I am going wrong. Any help would be appreciated.
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

------=_Part_756_1514042039.1477166829969
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Abdul<div><br></div><div>I suspect this may be more of =
a question for scala-user, but from a quick look, and without much investig=
ation, it seems the problem is that the compiler interprets the expression=
=C2=A0<span style=3D"font-family: Consolas, Menlo, Monaco, &quot;Lucida Con=
sole&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quo=
t;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-=
serif; white-space: inherit; background-color: rgb(239, 240, 241); color: r=
gb(48, 51, 54);">accumulate</span><span style=3D"font-family: Consolas, Men=
lo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;=
DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier=
 New&quot;, monospace, sans-serif; white-space: inherit; background-color: =
rgb(239, 240, 241); color: rgb(48, 51, 54);">[</span><span style=3D"font-fa=
mily: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation=
 Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&q=
uot;, &quot;Courier New&quot;, monospace, sans-serif; white-space: inherit;=
 background-color: rgb(239, 240, 241); color: rgb(48, 51, 54);">T</span><sp=
an style=3D"font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot=
;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstre=
am Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; wh=
ite-space: inherit; background-color: rgb(239, 240, 241); color: rgb(48, 51=
, 54);">,</span><span style=3D"font-family: Consolas, Menlo, Monaco, &quot;=
Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&q=
uot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monosp=
ace, sans-serif; white-space: inherit; background-color: rgb(239, 240, 241)=
; color: rgb(48, 51, 54);"> O</span><span style=3D"font-family: Consolas, M=
enlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quo=
t;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Couri=
er New&quot;, monospace, sans-serif; white-space: inherit; background-color=
: rgb(239, 240, 241); color: rgb(48, 51, 54);">,</span><span style=3D"font-=
family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberati=
on Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono=
&quot;, &quot;Courier New&quot;, monospace, sans-serif; white-space: inheri=
t; background-color: rgb(239, 240, 241); color: rgb(48, 51, 54);"> O</span>=
<span style=3D"font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&q=
uot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bits=
tream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif;=
 white-space: inherit; background-color: rgb(239, 240, 241); color: rgb(48,=
 51, 54);">](</span><span style=3D"font-family: Consolas, Menlo, Monaco, &q=
uot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mo=
no&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, mo=
nospace, sans-serif; white-space: inherit; background-color: rgb(239, 240, =
241); color: rgb(48, 51, 54);">a </span><span style=3D"font-family: Consola=
s, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, =
&quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;C=
ourier New&quot;, monospace, sans-serif; white-space: inherit; background-c=
olor: rgb(239, 240, 241); color: rgb(48, 51, 54);">=3D&gt;</span><span styl=
e=3D"font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quo=
t;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera=
 Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; white-spa=
ce: inherit; background-color: rgb(239, 240, 241); color: rgb(48, 51, 54);"=
> a</span><span style=3D"font-family: Consolas, Menlo, Monaco, &quot;Lucida=
 Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, =
&quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, s=
ans-serif; white-space: inherit; background-color: rgb(239, 240, 241); colo=
r: rgb(48, 51, 54);">)(</span><span style=3D"font-family: Consolas, Menlo, =
Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;Deja=
Vu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New=
&quot;, monospace, sans-serif; white-space: inherit; background-color: rgb(=
239, 240, 241); color: rgb(48, 51, 54);">to</span><span style=3D"font-famil=
y: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mo=
no&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot=
;, &quot;Courier New&quot;, monospace, sans-serif; white-space: inherit; ba=
ckground-color: rgb(239, 240, 241); color: rgb(48, 51, 54);">)</span>=C2=A0=
as if you were trying to pass explicit arguments for the implicit parameter=
s of the method accumulate. The method takes <i>two</i>=C2=A0implicit param=
eters, but the first argument list we are providing contains only one (a =
=3D&gt; a), so the compiler complains.</div><div><br></div><div>The followi=
ng variants, which help the compiler understand that we are <i>first</i> tr=
ying to &quot;create a version&quot; of the accumulate method with the type=
 parameters bound to T, O and O, <i>then</i>=C2=A0apply the arguments &quot=
;a =3D&gt; a&quot; and &quot;to&quot; to it, both work for me:</div><div><b=
r></div><div><div><font face=3D"courier new, monospace" size=3D"2">scala&gt=
; =C2=A0 def reduce[T[_]: Traversable, O: Monoid]: T[O] =3D&gt; O =3D to =
=3D&gt; {</font></div><div><font face=3D"courier new, monospace" size=3D"2"=
>=C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 val accumulateFun: (O =3D&gt; O) =3D&g=
t; T[O] =3D&gt; O =3D accumulate _</font></div><div><font face=3D"courier n=
ew, monospace" size=3D"2">=C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A0 accumulateFun=
(a =3D&gt; a)(to)</font></div><div><font face=3D"courier new, monospace" si=
ze=3D"2">=C2=A0 =C2=A0 =C2=A0| =C2=A0 }</font></div><div><font face=3D"cour=
ier new, monospace" size=3D"2">warning: there was one feature warning; re-r=
un with -feature for details</font></div><div><font face=3D"courier new, mo=
nospace" size=3D"2">reduce: [T[_], O](implicit evidence$1: Traversable[T], =
implicit evidence$2: Mono</font></div><div><font face=3D"courier new, monos=
pace" size=3D"2">id[O])T[O] =3D&gt; O</font></div><div><font face=3D"courie=
r new, monospace" size=3D"2"><br></font></div><div><font face=3D"courier ne=
w, monospace" size=3D"2">scala&gt; =C2=A0 def reduce[T[_]: Traversable, O: =
Monoid]: T[O] =3D&gt; O =3D to =3D&gt; accumulate[<br></font></div><div><fo=
nt face=3D"courier new, monospace" size=3D"2">T, O, O].apply(a =3D&gt; a)(t=
o)</font></div><div><font face=3D"courier new, monospace" size=3D"2">warnin=
g: there was one feature warning; re-run with -feature for details</font></=
div><div><font face=3D"courier new, monospace" size=3D"2">reduce: [T[_], O]=
(implicit evidence$1: Traversable[T], implicit evidence$2: Mono</font></div=
><div><font face=3D"courier new, monospace" size=3D"2">id[O])T[O] =3D&gt; O=
</font></div><br>Note that both variants result in a warning on 2.11.6:</di=
v><div><br></div><div><font face=3D"courier new, monospace">&lt;console&gt;=
:10: warning: higher-kinded type should be enabled</font></div><div><font f=
ace=3D"courier new, monospace">by making the implicit value scala.language.=
higherKinds visible.</font></div><div><font face=3D"courier new, monospace"=
>This can be achieved by adding the import clause &#39;import scala.languag=
e.higherKi</font></div><div><font face=3D"courier new, monospace">nds&#39;<=
/font></div><div><font face=3D"courier new, monospace">or by setting the co=
mpiler option -language:higherKinds.</font></div><div><font face=3D"courier=
 new, monospace">See the Scala docs for value scala.language.higherKinds fo=
r a discussion</font></div><div><font face=3D"courier new, monospace">why t=
he feature should be explicitly enabled.</font></div><div><br></div><div>Se=
e http://scalapuzzlers.com/#pzzlr-044 for a related code sample.</div><div>=
<br></div><div>Regards</div><div><br></div><div>ap</div><div><br></div><div=
><br></div><div>On Saturday, 22 October 2016 15:31:24 UTC-4,=C2=A0</div><di=
v><br></div><div>Abdul Rahman Sattar  wrote:<blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div dir=3D"ltr">Hi,=C2=A0<div><br></div><div><table style=3D=
"border-collapse:collapse;color:rgb(36,39,41);font-family:Arial,&quot;Helve=
tica Neue&quot;,Helvetica,sans-serif"><tbody><tr><td style=3D"padding-right=
:15px;vertical-align:top"><div style=3D"text-align:center;min-width:46px"><=
a title=3D"This question shows research effort; it is useful and clear" sty=
le=3D"margin-right:auto;margin-bottom:2px;margin-left:auto;font-size:1px;co=
lor:rgb(0,119,204);background-image:url(&quot;img/sprites.svg?v=3D8c1c8cba2=
42e&quot;),none;background-repeat:no-repeat;overflow:hidden;display:block;w=
idth:40px;min-height:30px;background-position:0px -170px">up vote</a><span =
style=3D"margin-top:8px;margin-bottom:8px;font-size:20px;display:block;colo=
r:rgb(106,115,124)"><br></span><a title=3D"This question does not show any =
research effort; it is unclear or not useful" style=3D"margin-right:auto;ma=
rgin-bottom:10px;margin-left:auto;font-size:1px;color:rgb(0,119,204);backgr=
ound-image:url(&quot;img/sprites.svg?v=3D8c1c8cba242e&quot;),none;backgroun=
d-repeat:no-repeat;overflow:hidden;display:block;width:40px;min-height:30px=
;background-position:0px -220px">down vote</a><a href=3D"http://stackoverfl=
ow.com/questions/40195799/what-is-wrong-with-the-method-definition#" title=
=3D"Click to mark as favorite question (click again to undo)" style=3D"marg=
in-right:auto;margin-bottom:2px;margin-left:auto;font-size:1px;color:rgb(0,=
119,204);background-image:url(&quot;img/sprites.svg?v=3D8c1c8cba242e&quot;)=
,none;background-repeat:no-repeat;overflow:hidden;display:block;width:40px;=
min-height:30px;background-position:0px -120px" target=3D"_blank" rel=3D"no=
follow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fstackoverflow.com%2Fquestions%2F40195799%2Fwhat-is-wrong-with-the-=
method-definition%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEgYxxz9JM9WGaI=
J7K80_il-Wx6Eg&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.go=
ogle.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F40195799%2Fw=
hat-is-wrong-with-the-method-definition%23\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNEgYxxz9JM9WGaIJ7K80_il-Wx6Eg&#39;;return true;">favorite</a><div><s=
pan style=3D"color:rgb(106,115,124)"></span></div></div></td><td style=3D"v=
ertical-align:top"><div style=3D"margin-bottom:5px;font-size:15px;width:660=
px;word-wrap:break-word;line-height:1.3"><p style=3D"margin-bottom:1em;clea=
r:both">Below are my method signatures and definitions in scala</p><pre sty=
le=3D"margin-bottom:1em;padding:5px;font-size:13px;width:auto;max-height:60=
0px;overflow:auto;font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&qu=
ot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstrea=
m Vera Sans Mono&quot;,&quot;Courier New&quot;,monospace,sans-serif;backgro=
und-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code styl=
e=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Lib=
eration Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans M=
ono&quot;,&quot;Courier New&quot;,monospace,sans-serif;white-space:inherit"=
><span style=3D"color:rgb(48,51,54)">  </span><span style=3D"color:rgb(16,1=
6,148)">def</span><span style=3D"color:rgb(48,51,54)"> accumulate</span><sp=
an style=3D"color:rgb(48,51,54)">[</span><span style=3D"color:rgb(48,51,54)=
">T</span><span style=3D"color:rgb(48,51,54)">[</span><span style=3D"color:=
rgb(48,51,54)">_</span><span style=3D"color:rgb(48,51,54)">]:</span><span s=
tyle=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(43,145,175)">=
Traversable</span><span style=3D"color:rgb(48,51,54)">,</span><span style=
=3D"color:rgb(48,51,54)"> O</span><span style=3D"color:rgb(48,51,54)">:</sp=
an><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(43,=
145,175)">Monoid</span><span style=3D"color:rgb(48,51,54)">,</span><span st=
yle=3D"color:rgb(48,51,54)"> A</span><span style=3D"color:rgb(48,51,54)">]:=
</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb=
(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">A </span><span styl=
e=3D"color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)"=
> O</span><span style=3D"color:rgb(48,51,54)">)</span><span style=3D"color:=
rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51,54)">=3D&gt;</span><s=
pan style=3D"color:rgb(48,51,54)"> T</span><span style=3D"color:rgb(48,51,5=
4)">[</span><span style=3D"color:rgb(48,51,54)">A</span><span style=3D"colo=
r:rgb(48,51,54)">]</span><span style=3D"color:rgb(48,51,54)"> </span><span =
style=3D"color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,=
54)"> O </span><span style=3D"color:rgb(48,51,54)">=3D</span><span style=3D=
"color:rgb(48,51,54)">
    fao </span><span style=3D"color:rgb(48,51,54)">=3D&gt;</span><span styl=
e=3D"color:rgb(48,51,54)"> ta </span><span style=3D"color:rgb(48,51,54)">=
=3D&gt;</span><span style=3D"color:rgb(48,51,54)">
      </span><span style=3D"color:rgb(48,51,54)">(</span><span style=3D"col=
or:rgb(48,51,54)">implicitly</span><span style=3D"color:rgb(48,51,54)">[</s=
pan><span style=3D"color:rgb(43,145,175)">Traversable</span><span style=3D"=
color:rgb(48,51,54)">[</span><span style=3D"color:rgb(48,51,54)">T</span><s=
pan style=3D"color:rgb(48,51,54)">]].</span><span style=3D"color:rgb(48,51,=
54)">tr<wbr>averse</span><span style=3D"color:rgb(48,51,54)">[({</span><spa=
n style=3D"color:rgb(16,16,148)">type</span><span style=3D"color:rgb(48,51,=
54)"> f</span><span style=3D"color:rgb(48,51,54)">[</span><span style=3D"co=
lor:rgb(48,51,54)">X</span><span style=3D"color:rgb(48,51,54)">]</span><spa=
n style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51,54)"=
>=3D</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color=
:rgb(43,145,175)">Acc</span><span style=3D"color:rgb(48,51,54)">[</span><sp=
an style=3D"color:rgb(48,51,54)">O</span><span style=3D"color:rgb(48,51,54)=
">,</span><span style=3D"color:rgb(48,51,54)"> X</span><span style=3D"color=
:rgb(48,51,54)">]})#</span><span style=3D"color:rgb(48,51,54)">f</span><spa=
n style=3D"color:rgb(48,51,54)">,</span><span style=3D"color:rgb(48,51,54)"=
> A</span><span style=3D"color:rgb(48,51,54)">,</span><span style=3D"color:=
rgb(48,51,54)"> O</span><span style=3D"color:rgb(48,51,54)">](</span><span =
style=3D"color:rgb(48,51,54)">ta</span><span style=3D"color:rgb(48,51,54)">=
)(</span><span style=3D"color:rgb(48,51,54)">a </span><span style=3D"color:=
rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)"> </span><s=
pan style=3D"color:rgb(43,145,175)">Acc</span><span style=3D"color:rgb(48,5=
1,54)">(</span><span style=3D"color:rgb(48,51,54)">fao</span><span style=3D=
"color:rgb(48,51,54)">(</span><span style=3D"color:rgb(48,51,54)">a</span><=
span style=3D"color:rgb(48,51,54)">)))).</span><span style=3D"color:rgb(48,=
51,54)">value

  </span><span style=3D"color:rgb(16,16,148)">def</span><span style=3D"colo=
r:rgb(48,51,54)"> reduce</span><span style=3D"color:rgb(48,51,54)">[</span>=
<span style=3D"color:rgb(48,51,54)">T</span><span style=3D"color:rgb(48,51,=
54)">[</span><span style=3D"color:rgb(48,51,54)">_</span><span style=3D"col=
or:rgb(48,51,54)">]:</span><span style=3D"color:rgb(48,51,54)"> </span><spa=
n style=3D"color:rgb(43,145,175)">Traversable</span><span style=3D"color:rg=
b(48,51,54)">,</span><span style=3D"color:rgb(48,51,54)"> O</span><span sty=
le=3D"color:rgb(48,51,54)">:</span><span style=3D"color:rgb(48,51,54)"> </s=
pan><span style=3D"color:rgb(43,145,175)">Monoid</span><span style=3D"color=
:rgb(48,51,54)">]:</span><span style=3D"color:rgb(48,51,54)"> T</span><span=
 style=3D"color:rgb(48,51,54)">[</span><span style=3D"color:rgb(48,51,54)">=
O</span><span style=3D"color:rgb(48,51,54)">]</span><span style=3D"color:rg=
b(48,51,54)"> </span><span style=3D"color:rgb(48,51,54)">=3D&gt;</span><spa=
n style=3D"color:rgb(48,51,54)"> O </span><span style=3D"color:rgb(48,51,54=
)">=3D</span><span style=3D"color:rgb(48,51,54)"> to </span><span style=3D"=
color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)"> acc=
umulate</span><span style=3D"color:rgb(48,51,54)">[</span><span style=3D"co=
lor:rgb(48,51,54)">T</span><span style=3D"color:rgb(48,51,54)">,</span><spa=
n style=3D"color:rgb(48,51,54)"> O</span><span style=3D"color:rgb(48,51,54)=
">,</span><span style=3D"color:rgb(48,51,54)"> O</span><span style=3D"color=
:rgb(48,51,54)">](</span><span style=3D"color:rgb(48,51,54)">a </span><span=
 style=3D"color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51=
,54)"> a</span><span style=3D"color:rgb(48,51,54)">)(</span><span style=3D"=
color:rgb(48,51,54)">to</span><span style=3D"color:rgb(48,51,54)">)</span><=
/code></pre><p style=3D"margin-bottom:1em;clear:both">However I get the fol=
lowing error for my definition of reduce</p><pre style=3D"margin-bottom:1em=
;padding:5px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-=
family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mo=
no&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,=
&quot;Courier New&quot;,monospace,sans-serif;background-color:rgb(239,240,2=
41);color:rgb(57,51,24);word-wrap:normal"><code style=3D"font-family:Consol=
as,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quo=
t;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier=
 New&quot;,monospace,sans-serif;white-space:inherit"><span style=3D"color:r=
gb(43,145,175)">Error</span><span style=3D"color:rgb(48,51,54)">:(</span><s=
pan style=3D"color:rgb(125,39,39)">160</span><span style=3D"color:rgb(48,51=
,54)">,</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"co=
lor:rgb(125,39,39)">82</span><span style=3D"color:rgb(48,51,54)">)</span><s=
pan style=3D"color:rgb(48,51,54)"> not enough arguments </span><span style=
=3D"color:rgb(16,16,148)">for</span><span style=3D"color:rgb(48,51,54)"> me=
thod accumulate</span><span style=3D"color:rgb(48,51,54)">:</span><span sty=
le=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,51,54)">(</s=
pan><span style=3D"color:rgb(16,16,148)">implicit</span><span style=3D"colo=
r:rgb(48,51,54)"> evidence$7</span><span style=3D"color:rgb(48,51,54)">:</s=
pan><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(43=
,145,175)">Traversable</span><span style=3D"color:rgb(48,51,54)">[</span><s=
pan style=3D"color:rgb(48,51,54)">T</span><span style=3D"color:rgb(48,51,54=
)">],</span><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"colo=
r:rgb(16,16,148)">implicit</span><span style=3D"color:rgb(48,51,54)"> evide=
nce$8</span><span style=3D"color:rgb(48,51,54)">:</span><span style=3D"colo=
r:rgb(48,51,54)"> </span><span style=3D"color:rgb(43,145,175)">Monoid</span=
><span style=3D"color:rgb(48,51,54)">[</span><span style=3D"color:rgb(48,51=
,54)">O</span><span style=3D"color:rgb(48,51,54)">])(</span><span style=3D"=
color:rgb(48,51,54)">O </span><span style=3D"color:rgb(48,51,54)">=3D&gt;</=
span><span style=3D"color:rgb(48,51,54)"> O</span><span style=3D"color:rgb(=
48,51,54)">)</span><span style=3D"color:rgb(48,51,54)"> </span><span style=
=3D"color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)">=
 </span><span style=3D"color:rgb(48,51,54)">(</span><span style=3D"color:rg=
b(48,51,54)">T</span><span style=3D"color:rgb(48,51,54)">[</span><span styl=
e=3D"color:rgb(48,51,54)">O</span><span style=3D"color:rgb(48,51,54)">]</sp=
an><span style=3D"color:rgb(48,51,54)"> </span><span style=3D"color:rgb(48,=
51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)"> O</span><span st=
yle=3D"color:rgb(48,51,54)">).</span><span style=3D"color:rgb(48,51,54)">
</span><span style=3D"color:rgb(43,145,175)">Unspecified</span><span style=
=3D"color:rgb(48,51,54)"> value parameter evidence$8</span><span style=3D"c=
olor:rgb(48,51,54)">.</span><span style=3D"color:rgb(48,51,54)">
  </span><span style=3D"color:rgb(16,16,148)">def</span><span style=3D"colo=
r:rgb(48,51,54)"> reduce</span><span style=3D"color:rgb(48,51,54)">[</span>=
<span style=3D"color:rgb(48,51,54)">T</span><span style=3D"color:rgb(48,51,=
54)">[</span><span style=3D"color:rgb(48,51,54)">_</span><span style=3D"col=
or:rgb(48,51,54)">]:</span><span style=3D"color:rgb(48,51,54)"> </span><spa=
n style=3D"color:rgb(43,145,175)">Traversable</span><span style=3D"color:rg=
b(48,51,54)">,</span><span style=3D"color:rgb(48,51,54)"> O</span><span sty=
le=3D"color:rgb(48,51,54)">:</span><span style=3D"color:rgb(48,51,54)"> </s=
pan><span style=3D"color:rgb(43,145,175)">Monoid</span><span style=3D"color=
:rgb(48,51,54)">]:</span><span style=3D"color:rgb(48,51,54)"> T</span><span=
 style=3D"color:rgb(48,51,54)">[</span><span style=3D"color:rgb(48,51,54)">=
O</span><span style=3D"color:rgb(48,51,54)">]</span><span style=3D"color:rg=
b(48,51,54)"> </span><span style=3D"color:rgb(48,51,54)">=3D&gt;</span><spa=
n style=3D"color:rgb(48,51,54)"> O </span><span style=3D"color:rgb(48,51,54=
)">=3D</span><span style=3D"color:rgb(48,51,54)"> to </span><span style=3D"=
color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51,54)"> acc=
umulate</span><span style=3D"color:rgb(48,51,54)">[</span><span style=3D"co=
lor:rgb(48,51,54)">T</span><span style=3D"color:rgb(48,51,54)">,</span><spa=
n style=3D"color:rgb(48,51,54)"> O</span><span style=3D"color:rgb(48,51,54)=
">,</span><span style=3D"color:rgb(48,51,54)"> O</span><span style=3D"color=
:rgb(48,51,54)">](</span><span style=3D"color:rgb(48,51,54)">a </span><span=
 style=3D"color:rgb(48,51,54)">=3D&gt;</span><span style=3D"color:rgb(48,51=
,54)"> a</span><span style=3D"color:rgb(48,51,54)">)(</span><span style=3D"=
color:rgb(48,51,54)">to</span><span style=3D"color:rgb(48,51,54)">)</span><=
span style=3D"color:rgb(48,51,54)">
                                                                           =
      </span><span style=3D"color:rgb(48,51,54)">^</span></code></pre><p st=
yle=3D"margin-bottom:1em;clear:both">Not sure where I am going wrong. Any h=
elp would be appreciated.</p><p style=3D"margin-bottom:1em;clear:both">Than=
ks!</p></div></td></tr></tbody></table></div></div></blockquote></div></div=
>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;scala-language&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">scal=
[email protected]</a>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

------=_Part_756_1514042039.1477166829969--

------=_Part_755_498969717.1477166829969--