<div dir="ltr">It's because first branch of last' returns a list instead of element.<br><br>last' [] = []<br><br>The actual type is<br><br>last' :: [a] -> [a]</div><br><div class="gmail_quote">On Tue, May 12, 2015 at 9:33 AM 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">
<div bgcolor="#FFFFFF" text="#000000">
Hello, <br>
<br>
To practice recursion I try to make some functions of Data list
myself on the recursive way.<br>
<br>
First I will try last.<br>
<br>
So I did this : <br>
<br>
-- | Main entry point to the application.<br>
module Main where<br>
<br>
-- | The main entry point.<br>
last' :: [a] -> a <br>
last' [] = [] <br>
last' (x:xs) = last xs<br>
<br>
<br>
but now I see this error message : <br>
<br>
<div>src/Main.hs@6:12-6:14 </div>
<div><span>Couldn't match expected type </span>
<div style="font-size:14px"><span>a</span></div>
<span> with actual type </span>
<div style="font-size:14px">[<span>t0</span>]</div>
<span> </span>
<div style="font-size:14px"><span>a</span></div>
<span> is a rigid type variable bound by the type signature for
last' :: [a] -> a at
/home/app/isolation-runner-work/projects/112712/session.207/src/src/Main.hs:5:10
Relevant
bindings include last' :: [a] -> a (bound at
/home/app/isolation-runner-work/projects/112712/session.207/src/src/Main.hs:6:1)</span><span title="Click to show/hide extra information"> …<br>
<br>
I my oponion I have said that the input is a array and the
output a string, <br>
<br>
Roelof<br>
<br>
</span></div>
<br>
<br><br>
<hr style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
<tr>
<td style="border:none;padding:0px 15px 0px 8px">
<a href="http://www.avast.com/" target="_blank">
<img border="0" src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo">
</a>
</td>
<td>
<p style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
<br><a href="http://www.avast.com/" target="_blank">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br>
</div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>