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 (Alexey Shmalko)
   2. Re:  AMQP and nested exception handlers (Alex)
   3. Re:  AMQP and nested exception handlers (Alexey Shmalko)
   4. Re:  why is this type wrong (Kim-Ee Yeoh)
   5. Re:  why is this type wrong (Nicolas SCHOEMAEKER)


----------------------------------------------------------------------

Message: 1
Date: Tue, 12 May 2015 06:51:29 +0000
From: Alexey Shmalko <[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:
        <cafc2pc4hbbelxka1gsoc6f6jwizzdhrvrlpgsvfo_f5l377...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I believe, you don't need main at all. Just load your source with ghci and
call your functions from there.

On Tue, May 12, 2015 at 9:48 AM Roelof Wobben <[email protected]> wrote:

>  Thanks
>
> Can I just say Main =
> I will google to look how to make a safeLast.
>
> Roelof
>
>
>
> Alexey Shmalko schreef op 12-5-2015 om 8:46:
>
> last' [] = error "last' on empty list"
>
> Otherwise, you should wrap the result in Maybe to make your function work
> as safeLast.
>
>  Oh... GHC's exception seems to say you haven't defined `main` in your
> module.
>
> On Tue, May 12, 2015 at 9:42 AM Roelof Wobben <[email protected]> wrote:
>
>>  Mike Meyer schreef op 12-5-2015 om 8:39:
>>
>> On May 12, 2015 1:32 AM, "Roelof Wobben" <[email protected]> wrote:
>> >
>> > Hello,
>> >
>> > To practice recursion I try to make some functions of Data list myself
>> on the recursive way.
>> >
>> > First I will try last.
>> >
>> > So I did this :
>> >
>> > -- | Main entry point to the application.
>> > module Main where
>> >
>> > -- | The main entry point.
>> > last' :: [a] -> a
>> > last' [] = []
>> > last' (x:xs) = last xs
>> >
>> >
>> > but now I see this error message :
>> >
>> > src/Main.hs@6:12-6:14
>> > Couldn't match expected type
>> > a
>> > with actual type
>> > [t0]
>> > a
>> > 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)
>> ?
>> >
>> > I my oponion I have said that the input is a array and the output a
>> string,
>>
>> 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.
>>
>> You need to return a string.
>>
>>
>> _______________________________________________
>> Beginners mailing 
>> [email protected]http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>>  Thanks,
>>
>> I did change it to this :
>>
>> -- | Main entry point to the application.
>> module Main where
>>
>> -- | The main entry point.
>> last' :: [a] -> a
>>  last' [x] = x
>>  last' (x:xs) = last xs
>>
>>  So I have to look at another way to say if there is a empty list then
>> there is no answer.
>> And when I run it  i see this error message :
>>
>> GHC threw an exception : Not in scope: ?Main.main?
>>
>>
>> Roelof
>>
>>
>>
>> ------------------------------
>>    [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
>>
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/ecca8cb7/attachment-0001.html>

------------------------------

Message: 2
Date: Tue, 12 May 2015 03:43:49 -0400
From: Alex <[email protected]>
To: Alexey Shmalko <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] AMQP and nested exception handlers
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

On Tue, 12 May 2015 06:25:44 +0000
Alexey Shmalko <[email protected]> wrote:

> Seems, that you're putting it in the wrong place. Please, publish
> your code to lpaste [1].
> 
> Hmm.... Maybe you need evaluate `encode req`?
> 

I've created a test case demonstrating the behavior which is confusing
me:

http://lpaste.net/132446

-- 
Alex


------------------------------

Message: 3
Date: Tue, 12 May 2015 08:32:08 +0000
From: Alexey Shmalko <[email protected]>
To: Alex <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] AMQP and nested exception handlers
Message-ID:
        <CAFC2PC5=0fp6ndkunuhdpcktk4-b6qm5k0p2ppfauon18pn...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Seems you lack the proper instance of NFData for Foo

instance NFData Foo where
    rnf f = foo f `deepseq` ()

With this change, keeping either line produces outer exception.

On Tue, May 12, 2015 at 10:43 AM Alex <[email protected]> wrote:

> On Tue, 12 May 2015 06:25:44 +0000
> Alexey Shmalko <[email protected]> wrote:
>
> > Seems, that you're putting it in the wrong place. Please, publish
> > your code to lpaste [1].
> >
> > Hmm.... Maybe you need evaluate `encode req`?
> >
>
> I've created a test case demonstrating the behavior which is confusing
> me:
>
> http://lpaste.net/132446
>
> --
> Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/bf4a05a7/attachment-0001.html>

------------------------------

Message: 4
Date: Tue, 12 May 2015 16:39:47 +0700
From: Kim-Ee Yeoh <[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:
        <capy+zdskvtecjgxmmt20hnwjvz_gsgvnrusxsbakbrm63dt...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/38810bc6/attachment-0001.html>

------------------------------

Message: 5
Date: Tue, 12 May 2015 11:45:01 +0200
From: Nicolas SCHOEMAEKER <[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="utf-8"

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, 11:40 AM, 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 list
>[email protected]
>http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150512/3d2b8420/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 18
*****************************************

Reply via email to