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:  Using findIndex and then splitAt in  Data.List
      (Francesco Ariis)
   2.  Bounded STM Queues with load shedding (Alex Hammel)


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

Message: 1
Date: Fri, 27 Feb 2015 23:18:47 +0100
From: Francesco Ariis <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Using findIndex and then splitAt in
        Data.List
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Fri, Feb 27, 2015 at 04:51:46PM -0500, David McBride wrote:
> Another way you can deal with this is using the maybe function.
> If you are absolutely positive that it can never fail, it doesn't
> hurt to choose a default index of 0.
>
> let gradeItemIndex = ...
> let twoListsTuple = splitAt (maybe 0 id gradeItemIndex)

And if you don't trust your gut feelings, instead of `maybe 0...` place

    maybe (error "tlt") id gradeItemIndex

as some kind of crude assertion.



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

Message: 2
Date: Fri, 27 Feb 2015 14:32:07 -0800
From: Alex Hammel <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Bounded STM Queues with load shedding
Message-ID:
        <ca+_xfepyvsbyyzc24tuocmg2t+fpwtaas9cu+btlq3+kfae...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi list,

It would be handy for me to have a bounded STM Queue along the lines of
TBQueue
<https://hackage.haskell.org/package/stm-2.4/docs/Control-Concurrent-STM-TBQueue.html>
with the difference that when the queue is full, a call to writeTBQueue is
a non-blocking no-op.

This is in the context of an asynchronous logging system. If the load
(somehow) gets heavy enough that the log message queue is taking up a lot
of memory, It's better to lose a few log messages than to have processes
block until the logger catches up.

Are there any off-the-shelf solutions?

Cheers,
Allex
<https://hackage.haskell.org/package/stm-2.4/docs/Control-Concurrent-STM-TBQueue.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150227/6ce7acad/attachment-0001.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 80, Issue 70
*****************************************

Reply via email to