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!!! https://

[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 t

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

2011-02-16 Thread Ketil Malde
Brandon S Allbery KF8NH 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 error

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 isn'

[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

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 (ch

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 wrote: > Hello, > > I was going through some of the tuturials and trying out differe

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

2011-02-16 Thread Ozgur Akgun
On 16 February 2011 09:19, Tako Schotanus 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 to go. Ozgur

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

2011-02-16 Thread Ertugrul Soeylemez
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Brandon S Allbery KF8NH 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 output will > b

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 hav

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 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 borrowed the

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] http://www.cs.kent.ac.uk/pubs/1995/6

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 wrote: > On 16 February 2011 09:19, Tako Schotanus 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 wonde

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 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 >> restriction of ho

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 wrote: > On 02/15/2011

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 compil

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 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 most suppor

Re: [Haskell-cafe] Haskell GUI

2011-02-16 Thread Felipe Almeida Lessa
On Wed, Feb 16, 2011 at 11:26 AM, Lyndon Maydwell 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 wrote: > On Wed, Feb 16, 2011 at 11:26 AM, Lyndon Maydwell wrote: >> OpenGL + GLUT has always been very reliable for me. > > I don't think this OpenGL + GLUT combination w

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 defini

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 un

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 says \n" where both and 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 '{ T_Mr } > ' says ' {

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 wrote: > Hi, > > using alex+happy, how could I parse lines like these? > >> "mr says \n" > > where both and may contain arbitrary characters (except > eol)? > > If I make lexer tokens > >> "mr "    { T_Mr } >> " says " { T_Says } >> \r?\n    {

Re: [Haskell-cafe] Alex question

2011-02-16 Thread Mihai Maruseac
On Tue, Feb 15, 2011 at 9:19 PM, Mihai Maruseac wrote: > On Tue, Feb 15, 2011 at 8:47 PM, Mihai Maruseac > 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 the >> "begin" symbol. As listed here[1

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

2011-02-16 Thread Stephen Tetley
On 16 February 2011 15:31, Roman Dzvinkovsky wrote: > > using alex+happy, how could I parse lines like these? > >> "mr says \n" Alex has both user states and powerful regex and character set operators (complement and set difference), that said, LR parsing plus Alex lexing doesn't look like a sa

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. Mostl

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 no

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 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 and CIAsc

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! @ @@@ T

[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 { ... }d

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 package

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

2011-02-16 Thread James Andrew Cook
On Feb 15, 2011, at 6:05 PM, Daniel Fischer 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 >> long in order to d

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 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 >> existing

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: http://www.haskell.org/pipermail/haskell-cafe/2

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 threa

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 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 ___ Haskell-Cafe mailing list Hask

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 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 > T

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

2011-02-16 Thread Max Bolingbroke
On 16 February 2011 22:48, Daniel Fischer 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 with -O2). Yep - d'oh! Thinking

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 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 that uses the new GHC

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 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 exception, I register a

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 wrote: > On Wed, Feb 16, 2011 at 9:27 PM, Bas van Dijk 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

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 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 Functor or App

[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 [3]

[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? T

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Sebastian Fischer
On Thu, Feb 17, 2011 at 11:32 AM, Evan Laforge 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) constraint that is not

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Evan Laforge
On Wed, Feb 16, 2011 at 11:28 PM, Sebastian Fischer wrote: > On Thu, Feb 17, 2011 at 11:32 AM, Evan Laforge 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 u

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Max Bolingbroke
On 17 February 2011 07:28, Sebastian Fischer 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 mtl1 Functor i