Re: [Haskell-cafe] Review request for platform independent interactive graphics with VNC

2011-02-16 Thread C K Kashyap
Hi, I've refined this further ... earlier, each framebuffer update involved sending the whole screen back, now, only the incremental changes are sent. Drawing on very large images are quick now!! Real fun will be when I can do rendering of graphics by typing things at the ghci prompt!!!

[Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
Dear all, I wrote a faster implementation for System.Timeout.timeout but wonder whether it's correct. It would be great if someone can review the code. The implementation comes with a tiny Criterion benchmark: darcs get http://bifunctor.homelinux.net/~bas/bench_timeouts/ On ghc-7.0.1 with -O2

Re: [Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-16 Thread Ketil Malde
Brandon S Allbery KF8NH allber...@gmail.com writes: openFile foo ReadMode = \handle - (hGetContents handle = (\s - hClose handle putStr s)) [2] This is a classic example of the dangers of hGetContents (and, more generally, of unsafeInterleaveIO). Which makes me wonder why it isn't an

Re: [Haskell-cafe] Haskell GUI

2011-02-16 Thread Heinrich Apfelmus
Chris Smith wrote: Mihai Maruseac wrote: Right now, I am unsure on what is best to use. Can someone give me any hints on which is the most kept-to-date and most supported GUI library? It would be hard to beat Gtk2Hs if you're looking for mature, solid, up to date, and widely used. Gtk2Hs

[Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Tako Schotanus
Hello, I was going through some of the tuturials and trying out different (syntactic) alternatives to the given solutions and I I got to this line: *length [chain x | x - [1..100] , length (chain x) 15]* Now, there's nothing wrong with it, it works of course. But the application of chain x

Re: [Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Miguel Mitrofanov
length [c | x - [1..100], let c = chain x, length c 15] 16.02.2011 12:19, Tako Schotanus пишет: Hello, I was going through some of the tuturials and trying out different (syntactic) alternatives to the given solutions and I I got to this line: *length [chain x | x - [1..100] , length

Re: [Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Stephen Lavelle
Might better ways, but the following work: length [c | x - [1..100], let c = chain x , length c 15] length [c | x - [1..100], c - [chain x] , length c 15] On Wed, Feb 16, 2011 at 9:19 AM, Tako Schotanus t...@codejive.org wrote: Hello, I was going through some of the tuturials and trying

Re: [Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Ozgur Akgun
On 16 February 2011 09:19, Tako Schotanus t...@codejive.org wrote: I wondered if there was a way for a guard in a list comprehension to refer to the item being produced? I'm just wondering about this very specific case Then, the answer is no. As others have noted, let binding is the way

Re: [Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-16 Thread Ertugrul Soeylemez
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Brandon S Allbery KF8NH allber...@gmail.com wrote: Haskell is actually what manufacturing folks call just in time; things are evaluated when they are needed. Usually this means that when you output something, anything needed to compute that

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Vincent Hanquez
On Tue, Feb 15, 2011 at 11:49:16PM -0200, Diego Souza wrote: Hi, thanks for the feedbacks. They sound very reasonable. Going back in time, the first version was in fact a pure library. However, at some point I changed this as I thought it would make it easier to use, which might have been

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Michael Snoyman
On Wed, Feb 16, 2011 at 8:38 AM, Jeremy Fitzhardinge jer...@goop.org wrote: On 02/15/2011 08:02 PM, Michael Snoyman wrote:  In the next iteration of WAI/http-enumerator, they will both depend on http-types most likely. But since http-types did not exist until recently, http-enumerator

Re: [Haskell-cafe] Proving correctness

2011-02-16 Thread Simon Thompson
I did some work years ago about giving a predicate logic treatment of Haskell, based on earlier work for Miranda, and formalised some proofs based on this in Isabelle. Here are the links: Logic for Miranda, revisited [from Formal Aspects of Computing, 1995]

Re: [Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Tako Schotanus
Ok, thanks all, that was what I was looking for :) -Tako On Wed, Feb 16, 2011 at 10:46, Ozgur Akgun ozgurak...@gmail.com wrote: On 16 February 2011 09:19, Tako Schotanus t...@codejive.org wrote: I wondered if there was a way for a guard in a list comprehension to refer to the item being

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I just submitted a patch for base: http://hackage.haskell.org/trac/ghc/ticket/4963 Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Using MonadFix to tie the knot with STM

2011-02-16 Thread Sebastiaan Visser
On Feb 12, 2011, at 6:08 PM, Antoine Latter wrote: On Sat, Feb 12, 2011 at 8:47 AM, Sebastiaan Visser hask...@fvisser.nl wrote: Hi all, During a little experiment I discovered there is no MonadFix instance available for the STM monad. Is this absence the consequence of some deep

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Diego Souza
Thanks! I'm going to start working on this. Creating specific typeclasses is a good idea and I also believe that these changes can be done without breaking existing code. I'll see how that goes and keep you guys updated. On Wed, Feb 16, 2011 at 4:27 AM, Jeremy Fitzhardinge jer...@goop.org wrote:

Re: [Haskell-cafe] coding a queue with reactive

2011-02-16 Thread sam . roberts . 1983
Thanks, Ryan. I think I unppderstand the idea behind your function, which is a lot cleaner then my first queue implementation. I'm not sure if I could have quite programmed it from scratch yet, but that will come in time! I had to fix up a little bit of glue code to get your suggestions to

Re: [Haskell-cafe] Haskell GUI

2011-02-16 Thread Lyndon Maydwell
OpenGL + GLUT has always been very reliable for me. On Wed, Feb 16, 2011 at 5:11 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Chris Smith wrote: Mihai Maruseac wrote: Right now, I am unsure on what is best to use. Can someone give me any hints on which is the most kept-to-date and

Re: [Haskell-cafe] Haskell GUI

2011-02-16 Thread Felipe Almeida Lessa
On Wed, Feb 16, 2011 at 11:26 AM, Lyndon Maydwell maydw...@gmail.com wrote: OpenGL + GLUT has always been very reliable for me. I don't think this OpenGL + GLUT combination works well for user interfaces in the sense that you have to build everything from the ground up. Cheers! -- Felipe.

Re: [Haskell-cafe] Haskell GUI

2011-02-16 Thread Lyndon Maydwell
That's true, but I've not had any luck with any other GUI libraries :( On Wed, Feb 16, 2011 at 9:35 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Wed, Feb 16, 2011 at 11:26 AM, Lyndon Maydwell maydw...@gmail.com wrote: OpenGL + GLUT has always been very reliable for me. I don't

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Diego Souza
I was thinking in separating the core and http functions in order to be able to provide implementation for http-enumerator without breaking existing clients. Also the ones who don't need http interface don't need to use the full stack. I was not aware of CPRNG classes, thanks for that. I'll

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I made a slight modification and now it runs 16 times faster than the original: timeout :: Int - IO a - IO (Maybe a) timeout n f | n 0= fmap Just f | n == 0= return Nothing | otherwise = do myTid - myThreadId timeoutEx - fmap Timeout newUnique

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Ross Paterson
On Tue, Feb 15, 2011 at 07:46:29PM -0800, Evan Laforge wrote: Do I really have to add (Functor m) to the 300 or so functions with (Monad m) on them? Or just not use fmap or applicative? If you're using Monad m to get Functor or Applicative instances for a functor built from m, then I'm afraid

[Haskell-cafe] happy + alex parsing question

2011-02-16 Thread Roman Dzvinkovsky
Hi, using alex+happy, how could I parse lines like these? mr username says message\n where both username and message may contain arbitrary characters (except eol)? If I make lexer tokens mr { T_Mr } says { T_Says } \r?\n{ T_Eol } .{ T_Char $$ } and parser 'mr '{

Re: [Haskell-cafe] Unit propagation

2011-02-16 Thread PatrickM
How can I create he function propagateUnits by just using this 2 functions and recursion? remove :: (Eq a) -a -[a] -[a] -This function removes an item from a list. assignModel :: Model - Formula - Formula -This function applies the assign function for all the assignments of a given model. --

Re: [Haskell-cafe] happy + alex parsing question

2011-02-16 Thread Mihai Maruseac
On Wed, Feb 16, 2011 at 5:31 PM, Roman Dzvinkovsky romand...@gmail.com wrote: Hi, using alex+happy, how could I parse lines like these? mr username says message\n where both username and message may contain arbitrary characters (except eol)? If I make lexer tokens mr     { T_Mr }

Re: [Haskell-cafe] Alex question

2011-02-16 Thread Mihai Maruseac
On Tue, Feb 15, 2011 at 9:19 PM, Mihai Maruseac mihai.marus...@gmail.com wrote: On Tue, Feb 15, 2011 at 8:47 PM, Mihai Maruseac mihai.marus...@gmail.com wrote: Hi, I want to make Alex to parse a file using states. I wrote a simple basic wrapped .x file but it complaints that it doesn't know

Re: [Haskell-cafe] happy + alex parsing question

2011-02-16 Thread Stephen Tetley
On 16 February 2011 15:31, Roman Dzvinkovsky romand...@gmail.com wrote: using alex+happy, how could I parse lines like these? mr username says message\n Alex has both user states and powerful regex and character set operators (complement and set difference), that said, LR parsing plus Alex

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Jeremy Fitzhardinge
On 02/16/2011 02:57 AM, Michael Snoyman wrote: I have yet to write to the mailing lists about it, but likely there will be a rename/expansion based on a recommendation by Johan. Basically, we need two datatypes: Ascii and CIAscii. I'm not sure if that addresses your questions though. Mostly

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Jeremy Fitzhardinge
On 02/16/2011 06:00 AM, Diego Souza wrote: I was thinking in separating the core and http functions in order to be able to provide implementation for http-enumerator without breaking existing clients. Also the ones who don't need http interface don't need to use the full stack. I was not

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Michael Snoyman
On Wed, Feb 16, 2011 at 7:20 PM, Jeremy Fitzhardinge jer...@goop.org wrote: On 02/16/2011 02:57 AM, Michael Snoyman wrote: I have yet to write to the mailing lists about it, but likely there will be a rename/expansion based on a recommendation by Johan. Basically, we need two datatypes: Ascii

Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org

2011-02-16 Thread Henning Thielemann
Thank you a lot for bringing code.haskell.org back! I missed it a lot! However, I still get $ ssh code.haskell.org @@@ @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @ @@@

[Haskell-cafe] open datatypes

2011-02-16 Thread rodrigo.bonifacio
Dear all, Supposing that I have a FlowObject datatype such as:data FlowObject = Activity { ...  }  | Start | End | Proceed | ...I could make "open" this datatype by refactoring this definition through a type class + one datatype for each kind of FlowObject. Such as:data Activity = Activity { ...

Re: [Haskell-cafe] Cabal license combinations

2011-02-16 Thread Henning Thielemann
Chris Smith schrieb: It feels to me like a quite reasonable simplification that if someone wants to offer different bits of code, with the intent that the license terms of the eventual executable may be different depending on which bits you use, then they ought to do so in different packages.

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread James Andrew Cook
On Feb 15, 2011, at 6:05 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Tuesday 15 February 2011 23:29:39, Andrew Coppin wrote: Ouch! I suppose what we could really do with is a combinator that runs a monadic action N times, without actually constructing a list N elements

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-16 Thread Diego Souza
Thanks! I'll merge it tonight :-) On Wed, Feb 16, 2011 at 3:33 PM, Jeremy Fitzhardinge jer...@goop.org wrote: On 02/16/2011 06:00 AM, Diego Souza wrote: I was thinking in separating the core and http functions in order to be able to provide implementation for http-enumerator without breaking

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread Daniel Fischer
On Wednesday 16 February 2011 19:31:05, James Andrew Cook wrote: Doesn't Control.Monad.replicateM_ do exactly that? Yes, right, forgot about that. That would've worked fine in Andrew's case. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] open datatypes

2011-02-16 Thread Stephen Tetley
The finally tagless and Generics as a Library styles can - though you loose pattern matching they are arguably still close to grammars. Pablo Nogueira has posted some examples of open types in Generics as a Library tagless style to Haskell cafe:

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
I realized that the previous timeout had problems when called in a masked thread. What happens is that the call to killThread will block because it can't throw the KillThread exception to the timeout thread because that thread is masked. I have to use unsafeUnmask to always unmask the timeout

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread Andrew Coppin
On 16/02/2011 06:31 PM, James Andrew Cook wrote: Doesn't Control.Monad.replicateM_ do exactly that? 10 points to Gryffindore. (Now, if only there was a version that feeds an integer to the monadic action as well... Still, it's not hard to implement.)

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread Max Bolingbroke
On 16 February 2011 21:51, Andrew Coppin andrewcop...@btinternet.com wrote: (Now, if only there was a version that feeds an integer to the monadic action as well... Still, it's not hard to implement.) As simple as: forM [1..x] mk_my_action ___

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread Daniel Fischer
On Wednesday 16 February 2011 23:13:10, Max Bolingbroke wrote: On 16 February 2011 21:51, Andrew Coppin andrewcop...@btinternet.com wrote: (Now, if only there was a version that feeds an integer to the monadic action as well... Still, it's not hard to implement.) As simple as: forM

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-16 Thread Max Bolingbroke
On 16 February 2011 22:48, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: The problem with that is that under certain circumstances the list is shared in nested loops, which was what caused the thread (it was mapM_ and not forM_, but I'd be very surprised if they behaved differently

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
On 16 February 2011 20:26, Bas van Dijk v.dijk@gmail.com wrote: The patch and benchmarks attached to the ticket are updated. Hopefully this is the last change I had to make so I can stop spamming. And the spamming continues... I started working on a hopefully even more efficient timeout

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Felipe Almeida Lessa
On Wed, Feb 16, 2011 at 9:27 PM, Bas van Dijk v.dijk@gmail.com wrote: I started working on a hopefully even more efficient timeout that uses the new GHC event manager. The idea is that instead of forking a thread which delays for the timeout period after which it throws a Timeout

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-16 Thread Bas van Dijk
On 17 February 2011 00:46, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Wed, Feb 16, 2011 at 9:27 PM, Bas van Dijk v.dijk@gmail.com wrote: I started working on a hopefully even more efficient timeout that uses the new GHC event manager. The idea is that instead of forking a

Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org

2011-02-16 Thread Duncan Coutts
On Wed, 2011-02-16 at 02:12 +, Duncan Coutts wrote: We have not yet re-enabled user login accounts, nor re-enabled access to code repositories. We will send a further update when these are re-enabled, or procedures for people to re-enable them are finalised. Logging in ==

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Evan Laforge
On Wed, Feb 16, 2011 at 7:01 AM, Ross Paterson r...@soi.city.ac.uk wrote: On Tue, Feb 15, 2011 at 07:46:29PM -0800, Evan Laforge wrote: Do I really have to add (Functor m) to the 300 or so functions with (Monad m) on them?  Or just not use fmap or applicative? If you're using Monad m to get

[Haskell-cafe] Haskell Weekly News: Issue 169

2011-02-16 Thread Daniel Santa Cruz
Welcome to issue 169 of the HWN, a newsletter covering developments in the [1]Haskell community. This release covers the week of February 6 - 12, 2011. Congrats to Bryan O'Sullivan and Mark Lentczner for pulling off a successfull [2]BayHac 2011! Announcements Joao Fernandes

[Haskell-cafe] Alex monadUserState question

2011-02-16 Thread Mihai Maruseac
Hi, Just downloaded the latest Alex package from Hackage (different from the one in Ubuntu's repositories by 2 minor versions) and found that the monadUserState wrapper still misses 2 functions for dealing with changes in the user supplied state. Is this intended or it was an unwanted omission?

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Sebastian Fischer
On Thu, Feb 17, 2011 at 11:32 AM, Evan Laforge qdun...@gmail.com wrote: Or will there just be massive signature rewriting in the wake of mtl2? I must admit I still don't understand your exact problem. Could you help me with an example where using mtl2 requires an additional (Functor m)

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Evan Laforge
On Wed, Feb 16, 2011 at 11:28 PM, Sebastian Fischer fisc...@nii.ac.jp wrote: On Thu, Feb 17, 2011 at 11:32 AM, Evan Laforge qdun...@gmail.com wrote: Or will there just be massive signature rewriting in the wake of mtl2? I must admit I still don't understand your exact problem. Could you help

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Max Bolingbroke
On 17 February 2011 07:28, Sebastian Fischer fisc...@nii.ac.jp wrote: I must admit I still don't understand your exact problem. Could you help me with an example where using mtl2 requires an additional (Functor m) constraint that is not required when using mtl1? I think the problem is that the