Re: [Haskell-cafe] A weird bug of regex-pcre

2012-12-18 Thread José Romildo Malaquias
On Tue, Dec 18, 2012 at 02:28:26PM +0800, Magicloud Magiclouds wrote: Attachment is the test text file. And I tested my regexp as this: Prelude :m + Text.Regex.PCRE Prelude Text.Regex.PCRE z - readFile test.html Prelude Text.Regex.PCRE let (b, m ,a, ss) = z =~ a href=\(.*?)\.*?img

Re: [Haskell-cafe] A weird bug of regex-pcre

2012-12-18 Thread Rico Moorman
I had similar issues a while ago. It had to do with UTF-8 encoding as far as I can recall. I wanted to wrap a multiline string (code listings) within some pandoc generated HTML of a hakyll page with a container div. The text to wrap would be determined using a PCRE regex. Here the (probably

[Haskell-cafe] TAP 2013: 2nd Call for Papers

2012-12-18 Thread Achim D. Brucker
(Apologies if you receive this announcement multiple times.) *** *** *** TAP 2013*** *** *** *** Abstract

Re: [Haskell-cafe] A weird bug of regex-pcre

2012-12-18 Thread Rico Moorman
regex = table\\s+class=\sourceCode[^]+.*?/table- And mind the sneaky single - ... it doe not belong there ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] HTF Quickcheck

2012-12-18 Thread graham
Are there any libraries that define various common generators ? What would be the cleanest way to define two positive integers below 1000 that are different ? Seems relatively easy with conditionals. Thanks On Tue, Dec 18, 2012, at 07:01 AM, gra...@fatlazycat.com wrote: So what use are

[Haskell-cafe] Race Condition in threads

2012-12-18 Thread mukesh tiwari
Hello All I have two questions. 1. I wrote this code to create 10 simultaneous threads. Could some one please tell me if this is correct or not ? incr_count :: MVar () - MVar Int - IO () incr_count m n = ( forM_ [ 1..1 ] $ \_ - modifyMVar_ n ( return . ( + 10 ) ) ) putMVar m () main ::

Re: [Haskell-cafe] HTF Quickcheck

2012-12-18 Thread Simon Hengel
On Tue, Dec 18, 2012 at 05:25:41PM +, gra...@fatlazycat.com wrote: Are there any libraries that define various common generators ? What would be the cleanest way to define two positive integers below 1000 that are different ? Seems relatively easy with conditionals. You can still use

Re: [Haskell-cafe] Race Condition in threads

2012-12-18 Thread Serguey Zefirov
2012/12/18 mukesh tiwari mukeshtiwari.ii...@gmail.com: Hello All I have two questions. 1. I wrote this code to create 10 simultaneous threads. Could some one please tell me if this is correct or not ? incr_count :: MVar () - MVar Int - IO () incr_count m n = ( forM_ [ 1..1 ] $ \_ -

Re: [Haskell-cafe] Race Condition in threads

2012-12-18 Thread mukesh tiwari
Hi Serguey Thank you for reply. I tried with IORef but I am missing a function which modify it. In this case every thread just write value 10 to variable n. incr_count :: MVar () - IORef Int - IO () incr_count m n = ( forM_ [ 1 .. 1 ] $ \_ - writeIORef n 10 ) putMVar m () main :: IO ()

Re: [Haskell-cafe] HTF Quickcheck

2012-12-18 Thread graham
Thanks, how does using /= not cause test failures ? Just the sample rate will be high enough ? On Tue, Dec 18, 2012, at 06:04 PM, Simon Hengel wrote: On Tue, Dec 18, 2012 at 05:25:41PM +, gra...@fatlazycat.com wrote: Are there any libraries that define various common generators ? What

[Haskell-cafe] my Fasta is slow ;(

2012-12-18 Thread Branimir Maksimovic
This time I have tried fasta benchmark since current entries does notdisplay correct output.Program is copy of mine http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fastalang=gppid=1c++ benchmark, but unfortunately executes more than twice time. Seems to me that culprit is in

Re: [Haskell-cafe] Observer pattern in haskell FRP

2012-12-18 Thread Heinrich Apfelmus
Nathan Hüsken wrote: On 12/08/2012 10:32 AM, Heinrich Apfelmus wrote: Fair enough, but I don't see how this can be fitted into a general pattern. If the animation state is coupled tightly to the game logic state, then the question whether the animation is part of the game logic or not does not

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Christopher Howard
On 12/17/2012 06:30 PM, Richard O'Keefe wrote: On 18/12/2012, at 3:45 PM, Christopher Howard wrote: It's basically the very old idea that an Abstract Data Type should be a nice algebra: things that look as though they ought to fit together should just work, and rearrangements of things

[Haskell-cafe] Incremental regular expressions - article and library

2012-12-18 Thread Eugene Kirpichov
Hi Haskellers, I just published an article that can be interesting to lovers of functional programming, even though it's not directly relevant to Haskell per se. http://jkff.info/articles/ire/ It's based on Dan Piponi's blogpost Fast incremental regular expression matching with monoids

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Gábor Lehel
On Tue, Dec 18, 2012 at 11:03 PM, Christopher Howard The original link I gave http://www.haskellforall.com/2012_08_01_archive.html purposely skipped over any discussion of objects, morphisms, domains, and codomains. The author stated, in his first example, that Haskell functions are a

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Jay Sulzberger
On Tue, 18 Dec 2012, Christopher Howard wrote: On 12/17/2012 06:30 PM, Richard O'Keefe wrote: On 18/12/2012, at 3:45 PM, Christopher Howard wrote: It's basically the very old idea that an Abstract Data Type should be a nice algebra: things that look as though they ought to fit together

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Ertugrul Söylemez
Christopher Howard christopher.how...@frigidcode.com wrote: Since I received the two responses to my question, I've been trying to think deeply about this subject, and go back and understand the core ideas. I think the problem is that I really don't have a clear understanding of the basics of

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Richard O'Keefe
On 19/12/2012, at 11:03 AM, Christopher Howard wrote: Since I received the two responses to my question, I've been trying to think deeply about this subject, and go back and understand the core ideas. I think the problem is that I really don't have a clear understanding of the basics of

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Alexander Solla
On Tue, Dec 18, 2012 at 4:49 PM, Ertugrul Söylemez e...@ertes.de wrote: These laws make morphisms isolated and composition lightweight as well as undisturbing. Now try to transfer these notions to a concrete category, for example the category of web servers: The objects are sets and a

[Haskell-cafe] efficient data structure: column with repeating values

2012-12-18 Thread Christopher Howard
Is there some good data type out there that basically provides a simple table, but with optimization for repeating values on one column? Something like: Data Table a b ...where it assumes that 'a' values will usually be unique, while 'b' values will usually be repeated from a small set? (But not

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Gershom Bazerman
On 12/17/12 9:45 PM, Christopher Howard wrote: However, what I'm wondering about is ideas that can be composed but that don't seem to fit the idea of category, because they don't obey the associativity law. To give a specific example (pseudo code like, without any idea here of implementation or

Re: [Haskell-cafe] efficient data structure: column with repeating values

2012-12-18 Thread Petr P
Hi, just an idea (using Seq from Data.Seq and Map from Data.Map): newtype DataTable a b = DataTable (Map b (Seq a)) or if you know you won't have repeated values, you could have newtype DataTable a b = DataTable (Map b (Set a)) Both those ideas sort the data (partially or fully). If you

Re: [Haskell-cafe] A weird bug of regex-pcre

2012-12-18 Thread Magicloud Magiclouds
I see. A known bug. Thank you all. On Tue, Dec 18, 2012 at 10:11 PM, Rico Moorman rico.moor...@gmail.comwrote: regex = table\\s+class=\sourceCode[^]+.*?/table- And mind the sneaky single - ... it doe not belong there ;-) -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Christopher Howard
On 12/18/2012 08:02 PM, Gershom Bazerman wrote: On 12/17/12 9:45 PM, Christopher Howard wrote: I don't think you're describing a Category in the sense of the Haskell Category typeclass. But that's ok! Just because some things are categories and are nice doesn't mean that we can't have other