Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: why is this type wrong (Roelof Wobben)
2. Re: why is this type wrong
(Sumit Sahrawat, Maths & Computing, IIT (BHU))
3. Re: why is this type wrong (Roelof Wobben)
----------------------------------------------------------------------
Message: 1
Date: Tue, 12 May 2015 14:36:58 +0200
From: Roelof Wobben <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] why is this type wrong
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/7255ebe5/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 12 May 2015 18:09:52 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] why is this type wrong
Message-ID:
<cajbew8ptpjjpbyd+-0hqzldmusqygvve2a75dehrb8k2brn...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
The type of (.)
(.) :: (b -> c) -> (a -> b) -> a -> c
Means that "last' [1,2,3]" should be a function, which it isn't
You can instead try,
main = (print . last') [1,2,3]
Or equivalently,
main = print . last' $ [1,2,3]
On 12 May 2015 at 18:06, Roelof Wobben <[email protected]> wrote:
> Thanks all.
>
> I have now this :
>
> -- | The main entry point.
> last' :: [a] -> Maybe a
> last' [] = Nothing
> last' [x] = Just x
> last' (_:xs) = last' xs
>
>
> main = print . last' [1,2,3]
>
> but I see this message about main :
>
>
>
>
>
>
>
> * GHC threw an exception : Couldn't match expected type ?GHC.Types.IO
> <http://GHC.Types.IO> a0? with actual type ?a1 -> GHC.Types.IO
> <http://GHC.Types.IO> ()? I work wih the fpcomplete and they demand a main
> in the code . Roelof *
>
>
> Nicolas SCHOEMAEKER schreef op 12-5-2015 om 11:45:
>
> Hi
>
> In your definition, you seem to have forgotten the case when your list is
> empty.
> [x] won't bind on [].
>
> Regards,
> Nicolas SCHOEMAEKER
>
> (*This email was composed from a mobile phone, please** excuse** any
> resulting mistakes*)
>
> Web, Cloud Computing & WebRTC developer
> Haskell Programmer
> Artificial Intelligence & Robotics enthusiast
> On May 12, 2015, at 11:40 AM, Kim-Ee Yeoh <[email protected]> wrote:
>>
>>
>> On Tue, May 12, 2015 at 1:42 PM, Roelof Wobben <[email protected]> wrote:
>>
>> -- | The main entry point.
>>> last' :: [a] -> a
>>> last' [x] = x
>>> last' (x:xs) = last xs
>>
>>
>> Notice that the last line does no recursion: it invokes the Prelude's
>> definition of last.
>>
>> -- Kim-Ee
>>
>> ------------------------------
>>
>> Beginners mailing
>> [email protected]http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing
> [email protected]http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
>
>
> ------------------------------
> [image: Avast logo] <http://www.avast.com/>
>
> Dit e-mailbericht is gecontroleerd op virussen met Avast
> antivirussoftware.
> www.avast.com
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/47e8063d/attachment-0001.html>
------------------------------
Message: 3
Date: Tue, 12 May 2015 14:48:42 +0200
From: Roelof Wobben <[email protected]>
To: [email protected], The Haskell-Beginners Mailing
List - Discussion of primarily beginner-level topics related to
Haskell <[email protected]>
Subject: Re: [Haskell-beginners] why is this type wrong
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/2be6cd23/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 83, Issue 19
*****************************************