<p dir="ltr">On May 12, 2015 1:32 AM, "Roelof Wobben" <<a href="mailto:r.wobben@home.nl">r.wobben@home.nl</a>> wrote:<br>
><br>
> 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>
> src/Main.hs@6:12-6:14<br>
> Couldn't match expected type<br>
> a<br>
> with actual type<br>
> [t0]<br>
> a<br>
> 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) …<br>
><br>
> I my oponion I have said that the input is a array and the output a string, </p>
<p dir="ltr">Except for saying list instead of array, I'd agree with that. But when you write last' [] = [], the output is [], which does not have the expected type of strong. So the actual type is a list.</p>
<p dir="ltr">You need to return a string.</p>