[Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread s9gf4ult
Hello, I am looking for MVar which can not be null. I need some kind of thread save atomic IO operation like I can do with modifyMVar, but I want this variable always contain some value and never be null. Thanks. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread Roman Cheplyaka
* s9gf4ult s9gf4...@gmail.com [2013-03-18 13:07:04+0600] Hello, I am looking for MVar which can not be null. I need some kind of thread save atomic IO operation like I can do with modifyMVar, but I want this variable always contain some value and never be null. Thanks. Wrap it into a

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread Alexander V Vershilov
If you have only one variable then you can use: atomicModifyIORef from IORef it will give you atomic transactions and IORef will always contains some value. If you have a list of variables you need to make atomic actions on, then you may like to use STM. On 18 March 2013 11:07, s9gf4ult

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread s9gf4ult
18.03.2013 13:26, Alexander V Vershilov ?: I can not use atomicModifyIORef because it works with pure computation atomicModifyIORef :: IORef http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-IORef.html#t:IORef a - (a - (a, b)) - IO

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread Edward Z. Yang
If you are doing IO operations, then the operation is hardly atomic, is it? Just take from the MVar, compute, and when you're done, put a value back on the MVar. So long as you can guarantee all users of the MVar take before putting, you will have the desired semantics. Something worth

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-03-18 Thread Aleksey Khudyakov
On 17 March 2013 21:49, Dominic Steinitz domi...@steinitz.org wrote: Aleksey Khudyakov alexey.skladnoy at gmail.com writes: I've tried to run you program and I've got approximately same results regardless of optimization level. Which versions of GHC, mwc-random, vector and primitive do you

[Haskell-cafe] Streaming bytes and performance

2013-03-18 Thread Konstantin Litvinenko
Hi All! I tune my toy project for performance and hit the wall on simple, in imperative world, task. Here is the code that model what I'm trying to achieve import qualified Data.ByteString.Lazy as L import Data.Word8(isSpace) import Data.Word import Control.Monad.State type Stream = State

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread Tim Docker
On 18/03/13 19:07, s9gf4ult wrote: nor STM, becuase IO is not acceptable inside STM transaction. I just need some thread-safe blocking variable like MVar modifyMVar :: MVar http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Concurrent-MVar.html#t:MVar a - (a - IO

[Haskell-cafe] haskell infrastruture poll

2013-03-18 Thread Alexander V Vershilov
Ladies and gentlemen! If you happen to be involved in using/developing haskell-powered software you might like to answer our poll on that matter [1]. Thanks in advance! [1] https://docs.google.com/forms/d/1y5WtrCB7O9-jb-2Mzo1MtkToh4O6oY2oBXGkc_Q-cy0/viewform -- Alexander

Re: [Haskell-cafe] Some aggregation of Haskell content

2013-03-18 Thread Christopher Done
As a follow up, here's an implementation: http://haskellnews.org/ More info here: http://www.reddit.com/r/haskell/comments/1ahgrn/haskell_news/c8xfp9s On 10 February 2013 18:22, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: I'm totally with this. Also, it is exhausting to check in so many

Re: [Haskell-cafe] Some aggregation of Haskell content

2013-03-18 Thread José Pedro Magalhães
On Mon, Mar 18, 2013 at 9:56 AM, Christopher Done chrisd...@gmail.comwrote: As a follow up, here's an implementation: http://haskellnews.org/ Could it have an RSS feed? Thanks, Pedro More info here: http://www.reddit.com/r/haskell/comments/1ahgrn/haskell_news/c8xfp9s On 10 February

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Konstantin Litvinenko
On 03/17/2013 07:08 AM, C K Kashyap wrote: I am working on an automation that periodically fetches bug data from our bug tracking system and creates static HTML reports. Things worked fine when the bugs were in the order of 200 or so. Now I am trying to run it against 3000 bugs and suddenly I

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Ivan Lazar Miljenovic
On 18 March 2013 21:01, Konstantin Litvinenko to.darkan...@gmail.com wrote: On 03/17/2013 07:08 AM, C K Kashyap wrote: I am working on an automation that periodically fetches bug data from our bug tracking system and creates static HTML reports. Things worked fine when the bugs were in the

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread C K Kashyap
Thanks Konstantin ... I'll try that out too... Regards, Kashyap On Mon, Mar 18, 2013 at 3:31 PM, Konstantin Litvinenko to.darkan...@gmail.com wrote: On 03/17/2013 07:08 AM, C K Kashyap wrote: I am working on an automation that periodically fetches bug data from our bug tracking system

[Haskell-cafe] How to use the nice test output spit out by test-framework with cabal test?

2013-03-18 Thread Alfredo Di Napoli
Hi guys, I've been wondering for a long time about how to use the nice terminal-base report spit out from test-framework when I type cabal test. Atm this is my run-of-the-mill cabal setting: test-suite test-all type: exitcode-stdio-1.0 main-is: Main.hs ghc-options: -w -threaded -rtsopts

Re: [Haskell-cafe] How to use the nice test output spit out by test-framework with cabal test?

2013-03-18 Thread Jan Stolarek
is it possible? The output you are looking for is in the log file: dist/test/opencv-simple-0.1.0.0-test-all.log It gets displayed only if something goes wrong (i.e. a test fails). If all tests pass it's logged to the file. I hope this helps. Janek

Re: [Haskell-cafe] Streaming bytes and performance

2013-03-18 Thread Gregory Collins
Put a bang pattern on your accumulator in go. Since the value is not demanded until the end of the program, you're actually just building up a huge space leak there. Secondly, unconsing from the lazy bytestring will cause a lot of allocation churn in the garbage collector -- each byte read in the

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Jesper Särnesjö
On Mon, Mar 18, 2013 at 11:27 AM, Brandon Allbery allber...@gmail.com wrote: On Sun, Mar 17, 2013 at 7:58 PM, Jason Dagit dag...@gmail.com wrote: On Sat, Mar 16, 2013 at 6:53 PM, Jesper Särnesjö sarne...@gmail.com wrote: To be clear, I think this isn't really an OpenGL problem, but rather one

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Dan Doel
Do note that deepSeq alone won't (I think) change anything in your current code. bug will deepSeq the file contents. And the cons will seq bug. But nothing is evaluating the cons. And further, the cons isn't seqing the tail, so none of that will collapse, either. So the file descriptors will still

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Konstantin Litvinenko
On 03/18/2013 06:06 PM, Dan Doel wrote: Do note that deepSeq alone won't (I think) change anything in your current code. bug will deepSeq the file contents. rfn fully evaluate 'bug' by reading all file content. Later hClose will close it and we done. Not reading all content will lead to semi

[Haskell-cafe] Announcement - HGamer3D - 0.2.1 - featuring FRP based GUI and more

2013-03-18 Thread Peter Althainz
Dear All, I'm happy to announce release 0.2.1 of HGamer3D, the game engine with Haskell API, featuring FRP based API and FRP based GUI. The new FRP API is based on the netwire package. Currently only available on Windows: http://www.hgamer3d.org. Peter

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Carter Schonwald
Hey Jesper, thanks for the headsup! please continue to share you findings on this matter, It sounds like it'll be really useful for folks! -Carter On Mon, Mar 18, 2013 at 9:19 AM, Jesper Särnesjö sarne...@gmail.com wrote: On Mon, Mar 18, 2013 at 11:27 AM, Brandon Allbery allber...@gmail.com

[Haskell-cafe] Improving my implementation of The Lady Tasting Tea

2013-03-18 Thread Mark Fredrickson
Hello, For my first project in Haskell, I thought I would re-implement a statistical problem that I have previously done in R. In his 1925 book, Fisher tells of an experiment in which a lady claims she can tell the difference in cups of tea that have the milk or the tea/water added first (I'm a

Re: [Haskell-cafe] Specialized Computer Architecture - A Question

2013-03-18 Thread OWP
If I may ask, I'm not quite sure what O(2^n) and O(1) are? Besides Moore's Law, digital computing also benefits from mature tools and expertise for optimizing performance at all levels of the system: process technology, fundamental circuits, layout and algorithms. Many engineers are

[Haskell-cafe] Fwd: Now Accepting Applications for Mentoring Organizations for GSoC 2013

2013-03-18 Thread Johan Tibell
[bcc: hask...@haskell.org] We should make sure that we apply for Google Summer of Code this year as well. It's been very successful in the previous year, where we have gotten several projects funded every year. -- Johan -- Forwarded message -- From: Carol Smith car...@google.com

Re: [Haskell-cafe] Specialized Computer Architecture - A Question

2013-03-18 Thread Gwern Branwen
On Mon, Mar 18, 2013 at 4:31 PM, OWP owpmail...@gmail.com wrote: If I may ask, I'm not quite sure what O(2^n) and O(1) are? Just a metaphor using algorithmic complexity, is all. I'm curious, were not all these built on the foundation of Moore's Law? Everything Vigoda lists has Moore's Law in

Re: [Haskell-cafe] Specialized Computer Architecture - A Question

2013-03-18 Thread Brandon Allbery
On Mon, Mar 18, 2013 at 4:31 PM, OWP owpmail...@gmail.com wrote: Let me rephrase that, of course they will survive politically. People built these tools and if built, they will be use but will they survive efficiently? In the future, if a particular specialized architecture is somewhat

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Albert Y. C. Lai
On 13-03-18 09:19 AM, Jesper Särnesjö wrote: Interestingly, running the program in GHCi with the -fno-ghci-sandbox flag, causes it to misbehave in the same way as when compiled: Then perhaps to mimic default ghci in hope of getting good results: - compile with -threaded (more candidly, link

[Haskell-cafe] Workshop on Generic Programming

2013-03-18 Thread Jacques Carette
Dear list subscribers, apologies if you receive multiple copies of this CFP. == CALL FOR PAPERS WGP 2013 9th ACM SIGPLAN Workshop on Generic Programming

Re: [Haskell-cafe] [Haskell] Fwd: Now Accepting Applications for Mentoring Organizations for GSoC 2013

2013-03-18 Thread Edward A Kmett
Absolutely. I've had it on my calendar for months. :) They just opened registration today. Our application will be going in tomorrow night after I get a chance to coördinate with a couple of other organizations that want to apply re: endorsements. Sent from my iPhone On Mar 18, 2013, at 4:49

Re: [Haskell-cafe] Specialized Computer Architecture - A Question

2013-03-18 Thread Richard A. O'Keefe
On 19/03/2013, at 9:31 AM, OWP wrote: If I may ask, I'm not quite sure what O(2^n) and O(1) are? Check any data structures and algorithms textbook. Reverting to the original topic, THIS is the age of specialised machines. A lot of the chips out there are not just a CPU but a SoC (System on a

Re: [Haskell-cafe] Specialized Computer Architecture - A Question

2013-03-18 Thread OWP
Ironically, you made an interesting point on how Moore's Law created the on chip real estate that made specialized machines possible. As transistor sizing shrinks and die sizes increase, more and more real estate should now be available for usage. Oddly, what destroyed specialized machines in

[Haskell-cafe] ANNOUNCE: HaTeX-3.5 - New version of the LaTeX library

2013-03-18 Thread Daniel Díaz Casanueva
Hi readers! A new version of HaTeX has just been released. More math symbols and utilities and a new attoparsec-based parser. This new version also includes a new matrix renderer. A summary of the changes: http://deltadiaz.blogspot.com/2013/03/hatex-35.html The package in Hackage:

Re: [Haskell-cafe] Need some advice around lazy IO

2013-03-18 Thread Edward Kmett
Konstantin, Please allow me to elaborate on Dan's point -- or at least the point that I believe that Dan is making. Using, let bug = Control.DeepSeq.rnf str `seq` fileContents2Bug str or ($!!) will create a value that *when forced* cause the rnf to occur. As you don't look at bug until much

Re: [Haskell-cafe] ANNOUNCE: HaTeX-3.5 - New version of the LaTeX library

2013-03-18 Thread Andrew Cowie
On Tue, 2013-03-19 at 00:47 -0400, Daniel Díaz Casanueva wrote: This new version also includes a new matrix renderer. I'm surprised you had to create a new 'matrix' package; I would have thought one of the existing math libraries would have had the types you need? AfC Sydney signature.asc