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: Bounded STM Queues with load shedding (Chadda? Fouch?)
2. Re: Using findIndex and then splitAt in Data.List
(Michael Orlitzky)
3. Re: Using findIndex and then splitAt in Data.List (Geoffrey Bays)
4. trying to install libraries for Haskell School of Expression (DJ)
5. Re: trying to install libraries for Haskell School of
Expression (Sumit Sahrawat, Maths & Computing, IIT (BHU))
----------------------------------------------------------------------
Message: 1
Date: Sat, 28 Feb 2015 16:19:01 +0100
From: Chadda? Fouch? <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Bounded STM Queues with load shedding
Message-ID:
<canfjzrbr6o+munpkspvpyfb8emywelffhoq+hfwmpxd6+dt...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You're probably not on the right mailing list, this seems more appropriate
to Haskell-cafe than to Haskell-beginners.
On Fri, Feb 27, 2015 at 11:32 PM, Alex Hammel <[email protected]> wrote:
> 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>
>
> _______________________________________________
> 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/20150228/120bac41/attachment-0001.html>
------------------------------
Message: 2
Date: Sat, 28 Feb 2015 10:52:17 -0500
From: Michael Orlitzky <[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=utf-8
On 02/28/2015 10:02 AM, Geoffrey Bays wrote:
> Michael:
> Thanks, split on would work nicely.
>
> I probably should have backed up in my reasoning process to say that my
> real task is to replace a data item in a list with another altered data
> item in the same position, or rather in FP, create a new list with the
> altered item in the same place. And I need a predicate to find the name of
> the item I want to replace.
> Any thoughts?
>
You can define a function to "fix" the thing that you want to alter, and
then map that function over the list. Just make sure that the function
only alters the thing that you want to alter. For example, suppose the
other numbers are afraid of 7, so you want to change 7 into 8 in some list:
-- Turn 7 into 8; leave everything else alone.
fix_seven :: Int -> Int
fix_seven 7 = 8
fix_seven x = x
numbers :: [Int]
numbers = [1..10]
ghci> print $ map fix_seven numbers
[1,2,3,4,5,6,8,8,9,10]
------------------------------
Message: 3
Date: Sat, 28 Feb 2015 21:58:50 -0500
From: Geoffrey Bays <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using findIndex and then splitAt in
Data.List
Message-ID:
<CAD8ukx5HQxZWNNzbtPMk6x0TNjBDxz-O+owVBfX-VJvgZ=w...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Michael:
Yes, a map with a function that leaves everything I do not want to change
alone, that would indeed be the smooth, obvious FP way to do it. I will
change my code to work this way. Thanks.
Geoffrey
On Feb 28, 2015 10:52 AM, "Michael Orlitzky" <[email protected]> wrote:
> On 02/28/2015 10:02 AM, Geoffrey Bays wrote:
> > Michael:
> > Thanks, split on would work nicely.
> >
> > I probably should have backed up in my reasoning process to say that my
> > real task is to replace a data item in a list with another altered data
> > item in the same position, or rather in FP, create a new list with the
> > altered item in the same place. And I need a predicate to find the name
> of
> > the item I want to replace.
> > Any thoughts?
> >
>
>
> You can define a function to "fix" the thing that you want to alter, and
> then map that function over the list. Just make sure that the function
> only alters the thing that you want to alter. For example, suppose the
> other numbers are afraid of 7, so you want to change 7 into 8 in some list:
>
> -- Turn 7 into 8; leave everything else alone.
> fix_seven :: Int -> Int
> fix_seven 7 = 8
> fix_seven x = x
>
> numbers :: [Int]
> numbers = [1..10]
>
> ghci> print $ map fix_seven numbers
> [1,2,3,4,5,6,8,8,9,10]
>
> _______________________________________________
> 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/20150228/d2a1d639/attachment-0001.html>
------------------------------
Message: 4
Date: Sat, 28 Feb 2015 23:40:49 -0500
From: DJ <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] trying to install libraries for Haskell
School of Expression
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Trying to install the package soegtk.
I am running linux mint 17 with the latest (as of Feb. 28) haskell
platform and cabal-install.
I did install gtk2hs-buildtools and put the .cabal/bin in my path.
Cannot install soegtk:
Failed to install glib-0.12.5.4
cabal: Error: some packages failed to install:
cairo-0.12.5.3 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.5.7 depends on glib-0.12.5.4 which failed to install.
pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
soegtk-0.12.1 depends on glib-0.12.5.4 which failed to install.
Confession: I abandoned Haskell two years ago because of frustration
with cabal and hackage. I decided to get back to the language today, and
to start with Haskell School of Expression. I immediately run into the
problem that the first thing I try to install with cabal does not work.
Thanks for any help. Please tell me things are not just as bad now as
they were when I left ;-)
- DJP -
------------------------------
Message: 5
Date: Sun, 1 Mar 2015 11:22:38 +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] trying to install libraries for
Haskell School of Expression
Message-ID:
<cajbew8novpm+51opm+fm08prmgfqjcthlfjtkx2xtia_cex...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
We have sandboxes now, which (I think) weren't there 2 yrs ago.
Try this:
$ mkdir hse # Directory for Haskell
school of expression
$ cd hse
$ cabal sandbox init # Create a new sandbox
$ cabal install gtk2hs-buildtools # Install
gtk2hs-buildtools inside sandbox
$ export PATH=".cabal-sandbox/bin:$PATH" # Add the binaries
installed in (current directory's) sandbox to $PATH
$ cabal install gtk # Install gtk (and
anything else you need)
The above works in my case. Also, if you have a lot of packages installed
in "~/.cabal", then I recommend that you remove them and install them in
sandboxes where they are actually required.
Manually, you'd do it as follows:
$ mv ~/.cabal/packages ~/temporary_package_storage # Long name to avoid
clash, save downloaded package sources
$ rm -rf ~/.ghc ~/.cabal # Remove all packages,
and ghc's knowledge of them
$ mkdir ~/.cabal # Make a new ~/.cabal
directory
$ mv ~/temporary_package_storage ~/.cabal/packages # Reinsert the saved
downloaded package sources
For more info, look here:
https://www.haskell.org/cabal/users-guide/installing-packages.html#developing-with-sandboxes
Also, after some time it becomes natural to deal with cabal.
For example, I have that export line in my .zshrc. Thus the sandbox
residing in current directory is always in my path.
Also, a shell function that you may want to use.
cabal-reset () {
if [[ ! -d ~/.cabal-packages ]] ; then # If backup does not
exist
mv ~/.cabal/packages ~/.cabal-packages # Make a backup
fi
rm -rf ~/.ghc ~/.cabal # Nuke everything
mkdir ~/.cabal # Create new ~/.cabal
ln -s ~/.cabal-packages ~/.cabal/packages # Symlink backup to
~/.cabal/packages
}
Hope this helps.
On 1 March 2015 at 10:10, DJ <[email protected]> wrote:
> Trying to install the package soegtk.
>
> I am running linux mint 17 with the latest (as of Feb. 28) haskell
> platform and cabal-install.
>
> I did install gtk2hs-buildtools and put the .cabal/bin in my path.
>
> Cannot install soegtk:
>
> Failed to install glib-0.12.5.4
> cabal: Error: some packages failed to install:
> cairo-0.12.5.3 failed during the configure step. The exception was:
> ExitFailure 1
> gio-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
> glib-0.12.5.4 failed during the configure step. The exception was:
> ExitFailure 1
> gtk-0.12.5.7 depends on glib-0.12.5.4 which failed to install.
> pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
> soegtk-0.12.1 depends on glib-0.12.5.4 which failed to install.
>
> Confession: I abandoned Haskell two years ago because of frustration with
> cabal and hackage. I decided to get back to the language today, and to
> start with Haskell School of Expression. I immediately run into the problem
> that the first thing I try to install with cabal does not work.
>
> Thanks for any help. Please tell me things are not just as bad now as they
> were when I left ;-)
>
> - DJP -
>
> _______________________________________________
> 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/20150301/509b5896/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 81, Issue 1
****************************************