<div dir="ltr">The type of (.)<div><br></div><div><font face="monospace, monospace">   (.) :: (b -> c) -> (a -> b) -> a -> c</font></div><div><font face="monospace, monospace"><br></font></div>Means that "last' [1,2,3]" should be a function, which it isn't<div>You can instead try,</div><div><br></div><div><font face="monospace, monospace">    main = (print . last') [1,2,3]</font></div><div><font face="monospace, monospace"><br></font></div>Or equivalently,<div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    main = print . last' $ [1,2,3]</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 May 2015 at 18:06, Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span> 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">
    <div>Thanks all. <br>
      <br>
      I have now this : <br><span class="">
      <br>
      -- | The main entry point.<br></span>
      last' :: [a] -> Maybe a<br>
      last' [] = Nothing<br>
      last' [x] = Just x <br>
      last' (_:xs) = last' xs<br>
      <br>
      <br>
      main = print . last' [1,2,3]<br>
      <br>
      but I see this message about main : <br>
      <br>
      <i>
        GHC threw an exception : Couldn't match expected type
        ‘<a href="http://GHC.Types.IO" target="_blank">GHC.Types.IO</a> a0’ with actual type ‘a1 -> <a href="http://GHC.Types.IO" target="_blank">GHC.Types.IO</a> ()’
        <br>
        <br>
        I work wih the fpcomplete and they demand a main in the code .<br>
        <br>
        Roelof<br>
        <br>
      </i><br>
      <br>
      <br>
      Nicolas SCHOEMAEKER schreef op 12-5-2015 om 11:45:<br>
    </div>
    <blockquote type="cite"><div><div class="h5">
      <p dir="ltr">Hi</p>
      <p dir="ltr">In your definition, you seem to have forgotten the
        case when your list is empty.<br>
        [x] won't bind on [].</p>
      <p dir="ltr">Regards,<br>
        Nicolas SCHOEMAEKER</p>
      <p dir="ltr">(<i>This email was composed from a mobile phone,
          please</i><i> excuse</i><i> any resulting mistakes</i>)</p>
      <p dir="ltr">Web, Cloud Computing & WebRTC developer<br>
        Haskell Programmer<br>
        Artificial Intelligence & Robotics enthusiast</p>
      <div class="gmail_quote">On May 12, 2015, at 11:40 AM, Kim-Ee Yeoh
        <<a href="mailto:ky3@atamo.com" target="_blank">ky3@atamo.com</a>> wrote:
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div class="gmail_extra"><br>
              <div class="gmail_quote">On Tue, May 12, 2015 at 1:42 PM,
                Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
                wrote:<br>
                <br>
                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span> -- | The main entry point.<br>
                    last' :: [a] -> a <br>
                  </span> last' [x] = x <br>
                  <span> last' (x:xs) = last xs</span></blockquote>
              </div>
              <br>
            </div>
            <div class="gmail_extra">Notice that the last line does no
              recursion: it invokes the Prelude's definition of last.<br>
            </div>
            <div class="gmail_extra"><br clear="all">
              <div>
                <div>-- Kim-Ee</div>
              </div>
            </div>
          </div>
          <pre><hr>
Beginners mailing list
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
        </blockquote>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
Beginners mailing list
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  
<br><span class=""><br>
<hr style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
        <tbody><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>
</tbody></table>
<br>
</span></div>

<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>