Re: [Haskell-cafe] Haskell Forum

2010-07-28 Thread Magnus Therning
On 27/07/10 18:58, Andrew Coppin wrote: Magnus Therning wrote: On 26/07/10 22:01, Andrew Coppin wrote: So I'm told. But it appears that some people believe that NNTP *is* Usenet, which is not the case. I use NNTP almost every single day, but I've never seen Usenet in my life... So

Re: [Haskell-cafe] Error Monad and strings

2010-07-28 Thread Evan Laforge
I've always thought that being able to write: catMaybes :: [Maybe a] - [a] catMaybes xs = [ x | Just x - xs ] is really cool, which relies on: fail _ = [] being in the Monad instance for List. Really? I thought that's just a feature of list comprehensions. List comps are not monads,

[Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Conrad Parker
Hi, I am reading data from a file as strict bytestrings and processing them in an iteratee. As the parsing code uses Data.Binary, the strict bytestrings are then converted to lazy bytestrings (using fromWrap which Gregory Collins posted here in January: -- | wrapped bytestring - lazy bytestring

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Jonas Almström Duregård
Hi, I cannot write classes that see into internal structure. For example, I cannot write my own (de)serialization without using from/toAscList. Actually I don't believe you can do this with TH either. TH splices code into the module where you use it. The generated code is then type checked in

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Serguey Zefirov
2010/7/28 Jonas Almström Duregård jonas.dureg...@gmail.com: Hi, I cannot write classes that see into internal structure. For example, I cannot write my own (de)serialization without using from/toAscList. Actually I don't believe you can do this with TH either. TH splices code into the

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Gábor Lehel
2010/7/28 Serguey Zefirov sergu...@gmail.com: 2010/7/28 Jonas Almström Duregård jonas.dureg...@gmail.com: Hi, I cannot write classes that see into internal structure. For example, I cannot write my own (de)serialization without using from/toAscList. Actually I don't believe you can do this

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Gábor Lehel
On Wed, Jul 28, 2010 at 12:55 PM, Gábor Lehel illiss...@gmail.com wrote: 2010/7/28 Serguey Zefirov sergu...@gmail.com: 2010/7/28 Jonas Almström Duregård jonas.dureg...@gmail.com: Hi, I cannot write classes that see into internal structure. For example, I cannot write my own (de)serialization

[Haskell-cafe] Class instances on class constraints

2010-07-28 Thread Dušan Kolář
Hello all, For school purposes, I would like to define something like this: module SetOverList( SetFromList , SetOL(..) ) where type SetFromList a = [a] addEq :: Eq a = a - SetFromList a - SetFromList a addEq v [] = [v] addEq v l@(x:xs) = if x==v then l else x :

Re: [Haskell-cafe] Class instances on class constraints

2010-07-28 Thread Felipe Lessa
2010/7/28 Dušan Kolář ko...@fit.vutbr.cz: which does not work, of course (Flexible or Undecidable instances won't help). The aim is to have addElem function that works differently according to situation whether a type, which is base of the list/set, is a member of class Eq or Ord. Could you

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread S. Doaitse Swierstra
On 27 jul 2010, at 09:30, Eugene Kirpichov wrote: Perhaps this might mean that we can get incremental and parallel regexp matching by associating each character with a linear operator This is exactly what is happening in the uu-parsinglib. Doaitse (matrix) over this or related semiring,

Re: [Haskell-cafe] Class instances on class constraints

2010-07-28 Thread Dušan Kolář
Yes! Thanks. Dušan On 07/28/2010 01:03 PM, Felipe Lessa wrote: 2010/7/28 Dušan Kolářko...@fit.vutbr.cz: which does not work, of course (Flexible or Undecidable instances won't help). The aim is to have addElem function that works differently according to situation whether a type, which is

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Eugene Kirpichov
This is very interesting! Could you provide some more info? T.i. where to look in the source, or on the web? 2010/7/28 S. Doaitse Swierstra doai...@swierstra.net: On 27 jul 2010, at 09:30, Eugene Kirpichov wrote: Perhaps this might mean that we can get incremental and parallel regexp

RE: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Simon Peyton-Jones
I assume you've seen http://hackage.haskell.org/trac/ghc/ticket/4222 There are non-obvious design choices here Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Serguey Zefirov | Sent: 28 July 2010 11:07 | To:

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Chris Kuklewicz
On 26/07/2010 16:23, Sebastian Fischer wrote: this year's ICFP features A Play on Regular Expressions where two Haskell programmers and an automata theory guru develop an efficient purely functional algorithm for matching regular expressions. That is wonderfully clean way to go straight to a

Re: [Haskell-cafe] Template Haskell sees into abstract data types

2010-07-28 Thread Serguey Zefirov
2010/7/28 Simon Peyton-Jones simo...@microsoft.com: I assume you've seen http://hackage.haskell.org/trac/ghc/ticket/4222 There are non-obvious design choices here Yes, I've seen that. Right now I just cannot grok it fully. I feel like I should share my current understanding with cafe, so I

Re: [Haskell-cafe] Parsec Best Practices examples

2010-07-28 Thread Stephen Tetley
Hello I'm not sure trapping multiple errors is readily achievable with Parsec - I think you would want to do this with 'error correction' so you can log an error but then continue parsing. You could probably add your own error correction strategy but it would likely make the parsers convoluted.

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
Have you thought about supporting anchors like (^) and ($) ? We went the opposite route, made full matching the default, and implemented partial matching by pre- and appending .* As there are both a fullMatch and a partialMatch function, I don't see an immediate need for anchors, although

Re: [Haskell-cafe] Parsec Best Practices examples

2010-07-28 Thread David Place
On Jul 28, 2010, at 8:06 AM, Stephen Tetley wrote: Doaitse Swierstra's parser combinators have error correction. Thanks, Stephen. That is the approach I will take. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread S. Doaitse Swierstra
On 28 jul 2010, at 13:17, Eugene Kirpichov wrote: This is very interesting! Could you provide some more info? T.i. where to look in the source, or on the web? see: file:///Users/doaitse/.cabal/share/doc/uu-parsinglib-2.4.2/html/index.html The README.hs module contains some further

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Chris Kuklewicz
As there are both a fullMatch and a partialMatch function, I don't see an immediate need for anchors, although I admit that they have the advantage that you can specify *in the regexp* whether you want full or partial matching. The REG_NEWLINE flag for compiling POSIX regular expressions is

[Haskell-cafe] ANN: weighted-regexp-0.2.0.0

2010-07-28 Thread Sebastian Fischer
I have uploaded version 0.2.0.0 of the weighted-regexp package for weighted regular expression matching to Hackage. The changes are briefly 0.2.0.0 More general types for matching functions Renamed accept to acceptFull, added acceptPartial Strict numeric semiring SPECIALIZE pragmas

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Gregory Collins
Conrad Parker con...@metadecks.org writes: Hi, I am reading data from a file as strict bytestrings and processing them in an iteratee. As the parsing code uses Data.Binary, the strict bytestrings are then converted to lazy bytestrings (using fromWrap which Gregory Collins posted here in

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Martijn van Steenbergen
On 7/28/10 14:53, S. Doaitse Swierstra wrote: see: file:///Users/doaitse/.cabal/share/doc/uu-parsinglib-2.4.2/html/index.html Readers might have more luck with the following URLs: http://hackage.haskell.org/package/uu-parsinglib

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Martijn van Steenbergen
On 7/27/10 9:58, Sebastian Fischer wrote: On Jul 27, 2010, at 9:15 AM, Sjoerd Visscher wrote: Oh, by the way, with noMatch, eps, alt and seq_ RegExp is itself a Semiring, Yes, but it's hard to define an Eq instance for arbitrary regular expressions that reflects equivalence of regexps.

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
Oh, by the way, with noMatch, eps, alt and seq_ RegExp is itself a Semiring, Yes, but it's hard to define an Eq instance for arbitrary regular expressions that reflects equivalence of regexps. How hard is this exactly? The standard algorithm to decide regexp equivalence transforms both

Re: [Haskell-cafe] Re: Lists and monads

2010-07-28 Thread Tommy M. McGuire
On 07/26/2010 08:13 AM, Kevin Jardine wrote: On Jul 26, 3:00 pm, Vo Minh Thu not...@gmail.com wrote: Also, just like with IO, maybe restructuring the code to separate monadic code would help. The specific monad I am dealing with carries state around inside it. I could revert to a pure

Re: [Haskell-cafe] hGetContents: resource exhausted

2010-07-28 Thread Lally Singh
Ah, it's getting EAGAIN from fds created from prior pipe() calls. The other sides look like they were DUP2'd to fds 01, I'm guessing for a fork/exec(). On Mon, Jul 26, 2010 at 10:23 PM, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On

[Haskell-cafe] ANN: syz-0.2.0.0

2010-07-28 Thread Michael D. Adams
Hi all, This years Workshop on Generic Programming includes a generic zipper for Haskell that defines a Zipper type permitting zipper traversals over arbitrary instances of Data. A Haskell library based on those ideas is now available from Hackage at: http://hackage.haskell.org/package/syz

Fwd: [Haskell-cafe] fine control of bytestring streaming

2010-07-28 Thread Alberto G. Corona
Thanks Henning , I finally found the problem and an elegant solution (I guess) The problem is not, as I feared, the coalescence of bytestring chunks in more bigger chunks, but the buffering mode of the stream. The stream simply waits until the buffer is full to stream its content. So the

Re: [Haskell-cafe] hGetContents: resource exhausted

2010-07-28 Thread Donn Cave
Quoth Lally Singh lally.si...@gmail.com, Ah, it's getting EAGAIN from fds created from prior pipe() calls. The other sides look like they were DUP2'd to fds 01, I'm guessing for a fork/exec(). Well, that isn't a big surprise - it's the way you would expect to get EAGAIN. So ... evidently

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
REG_NEWLINE Compile for newline-sensitive matching. By default, newline is a completely ordinary character with no special meaning in either REs or strings. With this flag, `[^' bracket expressions and `.' never match newline, a `^' anchor matches the null string after any newline in the

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Chris Kuklewicz
Maybe I underestimated the utility of ^ and $. The definition seems intricate. I thought about adding a combinator for matching newline but now think that would lead to wrong start and end positions. For example the start position of the matching substring for ^a in a\na should be 2 not

Re: [Haskell-cafe] new Cabal user question -- installing to Haskell Platform on Windows network drive?

2010-07-28 Thread Peter Schmitz
Rogan: Again, thanks very much for your reply. My situation is that I need to be able to use Cabal (and the Haskell Platform, Gtk2Hs, etc.) at any of several PCs in a (Windows XP) LAN, each of which has access to the network drive H:. So, I am using: H:\proc\tools\Haskell Platform

[Haskell-cafe] Memory and Threads - MVars or TVars

2010-07-28 Thread Eitan Goldshtrom
Hi everyone. I was wondering if someone could just guide me toward some good information, but if anyone wants to help with a personal explanation I welcome it. I'm trying to write a threaded program and I'm not sure how to manage my memory. I read up on MVars and they make a lot of sense. My

Re: [Haskell-cafe] new Cabal user question -- installing to Haskell Platform on Windows network drive?

2010-07-28 Thread Duncan Coutts
On 28 July 2010 23:46, Peter Schmitz ps.hask...@gmail.com wrote: I will try experimenting with editing the config file and using that hidden option you mentioned. ** Cabal experts: If anyone knows how to do this sort of thing in a better way, I would appreciate a word. Rogan is right. You

[Haskell-cafe] Re: Memory and Threads - MVars or TVars

2010-07-28 Thread Günther Schmidt
Hi Eitan, I'm right now approaching the subject of concurrency myself for the first time in an application that spiders web pages. The getting the web pages part via http request is the one that is time consuming and thus the one that I wish to concurrentalize, ie. getting up to 6 six pages

Re: [Haskell-cafe] Re: Memory and Threads - MVars or TVars

2010-07-28 Thread Eitan Goldshtrom
I can't believe I never knew about Cabal. I'm getting Orc now. It looks very interesting. Thanks for the help. -Eitan On 7/28/2010 9:17 PM, Günther Schmidt wrote: Hi Eitan, I'm right now approaching the subject of concurrency myself for the first time in an application that spiders web

Re: [Haskell-cafe] Memory and Threads - MVars or TVars

2010-07-28 Thread Job Vranish
Atomic operations are special operations where you don't have to worry about some other process messing with things while the operation is taking place. For a simple example of why atomic operations are important: (taken from: http://en.wikipedia.org/wiki/Linearizability#Non-atomic) The naive,

Re: [Haskell-cafe] new Cabal user question -- installing to Haskell Platform on Windows network drive?

2010-07-28 Thread Peter Schmitz
Rogan is right. You just need to edit the cabal config file to point to locations on your other drive. I would suggest not relocating the config file itself. If you really must do so then you can use the --config-file flag or the environment variable CABAL_CONFIG. Duncan I will try

Re: [Haskell-cafe] Memory and Threads - MVars or TVars

2010-07-28 Thread Eitan Goldshtrom
Ah! That clears that up a lot. I read the wiki page but something just didn't make full sense about it until you used the word prevent. I understand that the computer doesn't actually prevent other threads from running -- that would defeat the purpose of the concurrency -- but it helped clear

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Max Cantor
I have a similar issue, I think. The problem with attoparsec is it only covers the unmarshalling side, writing data to disk still requires manually marshalling values into ByteStrings. Data.Binary with Data.Derive provide a clean, proven (encode . decode == id) way of doing this. If