<br>Consider what happens if you apply the last function to xs.<div><span></span><br>On Monday, November 10, 2014, Roelof Wobben <<a href="mailto:r.wobben@home.nl">r.wobben@home.nl</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course the compiler is right.<br>
<br>
Im still struggeling.<br>
<br>
What I try to do is this<br>
<br>
1) if acc is empty then a empty list so the output must be Nothing<br>
2) if the input has only one item then it is the last so the output must be that item.<br>
3) if the input has more then 1item then the last item is not reached so acc must have the value of the next item of the input file<br>
<br>
And I do not see how I can give acc the value of the next value of the input file maybe head xs<br>
<br>
Roelof<br>
<br>
<br>
Leza Morais Lutonda schreef op 10-11-2014 19:52:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Roelof,<br>
<br>
On 10/11/14 10:10, Roelof Wobben wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
No problem .<br>
<br>
Im strugelling to make acc work.<br>
<br>
I try to say that if the input list has only 1 item the outcome is the head of that list.<br>
But doing<br>
<br>
acc = Just (head a)  or doing acc = Just (head acc) gives both that acc or a is not in scope<br>
</blockquote>
The `a` in the type signature `acc :: a -> Maybe a -> Maybe a` is not a variable name, it is a type.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
also doing acc x = Just (head x) gives a error messages that the types are not matching.<br>
</blockquote>
:t Just (head x)<br>
Maybe a<br>
<br>
:t acc x<br>
Maybe a -> Maybe a<br>
<br>
So, the compiler is right!<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Roelof<br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a>Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote></div><br><br>-- <br>Sent from an iPhone, please excuse brevity and typos.<br>