Re: [Haskell-cafe] Re: Network.HTTP+ByteStrings Interface--Or: How to shepherd handles and go with the flow at the same time?

2007-05-26 Thread Jules Bean
Pete Kazmier wrote: Jules Bean [EMAIL PROTECTED] writes: E,F. Progressive GET pSynGET :: URL - ((Bool,ByteString) - IO ()) - IO () pAsynGET :: URL - ((Bool,ByteString) - IO ()) - IO (MVar ()) Incidentally there are more complex options than (Bool,Bytestring) - IO (). A

[Haskell-cafe] Cannot compile Network.CGI programs

2007-05-26 Thread Adrian Neumann
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Hi, I installed the Network.CGI package and tried to compile the Hello World example on my Ubuntu machine. ghc cgi.hs -o cgi gives me cgi.o: In function `r1hk_info': (.text+0x56): undefined reference to

Re: [Haskell-cafe] Cannot compile Network.CGI programs

2007-05-26 Thread Donald Bruce Stewart
aneumann: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Hi, I installed the Network.CGI package and tried to compile the Hello World example on my Ubuntu machine. ghc cgi.hs -o cgi Missing --make to link against the cgi and network and mtl packages. Also, -O or -O2, you may as

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-26 Thread Matthew Sackman
At Fri, 25 May 2007 12:23:24 -0500, Doug Kirk [EMAIL PROTECTED] wrote: I realise that everyone wants to eat their own dog food, but really, if you want the code samples to be available to the masses, you'll use Subversion instead of darcs. No offense to the darcs creators, but 1) Only

[Haskell-cafe] Re: CYK-style parsing and laziness

2007-05-26 Thread apfelmus
Steffen Mazanek wrote: apfelmus wrote The key point of the dynamic programming algorithm is indeed to memoize the results gs i j for all pairs of i and j. In other words, the insight that yields a fast algorithm is that for solving the subproblems gs i j (of which there are n^2), solution to

[Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Since the online lambdabot still doesn't seem to want to talk to me, I've been thinking about how I might rectify the situation... Apparently GHC has a flag that makes it execute a Haskell expression directly. For example, C:\ ghc -e map (2*) [1,2,3] [2,4,6] Now, if I could just figure out

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
andrewcoppin: Since the online lambdabot still doesn't seem to want to talk to me, I've been thinking about how I might rectify the situation... Apparently GHC has a flag that makes it execute a Haskell expression directly. For example, C:\ ghc -e map (2*) [1,2,3] [2,4,6] Now, if I

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-26 Thread David House
On 26/05/07, Matthew Sackman [EMAIL PROTECTED] wrote: (On the other hand, I don't know of anyone outside immediate haskellers using Darcs.) A lot of people in the Emacs subcommunity use darcs; many of them may have heard of Haskell but certainly wouldn't describe themselves as Haskellers. See

[Haskell-cafe] Darcs users [was: New book: Real-World Haskell!]

2007-05-26 Thread Donald Bruce Stewart
On 26/05/07, Matthew Sackman [EMAIL PROTECTED] wrote: (On the other hand, I don't know of anyone outside immediate haskellers using Darcs.) Good idea to get some data on this, instead of speculating. Let's do that. A quick google reveals the Haskell crew is far from alone as users.

[Haskell-cafe] Re: Darcs users [was: New book: Real-World Haskell!]

2007-05-26 Thread David House
On 26/05/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: darcs.pugscode.org/_darcs/ www.n-heptane.com/nhlab/repos/cabalDebianTemplate/_darcs/ www.khjk.org/~sm/code/advopost/_darcs/ These are also Haskell repos that you missed, bringing the figure up to 8. Still, I wouldn't

Re: [Haskell-cafe] Yet another top-level state proposal

2007-05-26 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Judah Jacobson wrote: Hi all, Given the recent discussion about adding top-level mutable state to Haskell, I thought it might be a good time to throw my own proposal into the ring. If enough people think it's worth considering, I can add it to

Re: [Haskell-cafe] Broadcast signals between threads

2007-05-26 Thread Tomasz Zielonka
On Fri, May 25, 2007 at 07:57:45PM +0200, Joachim Breitner wrote: I???m writing a TCP server app ATM. It has one thread per client. Some of the clients want to be notified if the internal state changes, while others are happily chatting with the server, possible modifying the internal state.

Re: [Haskell-cafe] Yet another top-level state proposal

2007-05-26 Thread Felipe Almeida Lessa
On 5/26/07, Isaac Dupree [EMAIL PROTECTED] wrote: (P.S. having read the Top_level_mutable_state page now, it is definitely worth reading) I'm a newbie in Haskell, but for me this seems to be the better proposal until now. It's definitely worth adding to the wiki, at least. -- Felipe.

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
claus.reinke: Oh, but there is the *minor* detail that I am literally allowing unauthenticated users to perform arbitrary code execution. For example, .. AFAIK, Lambdabot dissalows any expression that performs IO. In Haskell, this is beautifully easy: reject any expression having an IO type.

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Don't use parsing for security, use the type checker. By using 'show', you can write an instance for IO a that renders all IO harmless. Then just wrap your user's arbitrary expression in 'show. OK, what... the... hell...? I just looked on the list archive, and sure enough that's a quote from

[Haskell-cafe] shared oneShot IO (was top-level state proposals)

2007-05-26 Thread Claus Reinke
i thought the discussion had actually progressed a little further than might be obvious from http://www.haskell.org/haskellwiki/Top_level_mutable_state here is my summary of what i thought was the state of the discussion, followed by a hopefully simpler proposal. first, i'd like to

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
it would really be nice if someone would sit down and sort this all out in detail. there'd still be no guarantee that such a Haskell sandbox was totally safe, but at least all issues and solutions could be shared, making it as safe as the community knows how. The #haskell people have been

Re: [Haskell-cafe] Yet another top-level state proposal

2007-05-26 Thread Adrian Hey
Hello, It's nice to see someone else is seriously thinking about this and I can't see anything obviously wrong with this on first inspection so by all means add it to the wiki. I have a few issues with it on aesthetic grounds though. There also seems to be a bit of problem with using this

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Claus Reinke
Oh, but there is the *minor* detail that I am literally allowing unauthenticated users to perform arbitrary code execution. For example, .. AFAIK, Lambdabot dissalows any expression that performs IO. In Haskell, this is beautifully easy: reject any expression having an IO type. .. Don't use

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Donald Bruce Stewart wrote: Lambdabot uses 1) type guarantee of no-IO at the top level, along with 2) a trusted module base (pure module only, that are trusted to not export evil things), as well as 3) restricting only to H98-language only (things

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
isaacdupree: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Donald Bruce Stewart wrote: Lambdabot uses 1) type guarantee of no-IO at the top level, along with 2) a trusted module base (pure module only, that are trusted to not export evil things), as well as 3) restricting only to

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Claus Reinke
The #haskell people have been working on this for about 3 years now. The result is the 'runplugs' program, which I've talked about in previous mails. http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/RunPlugs.hs It uses hs-plugins for the evaluation, along with the points about IO

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Donald Bruce Stewart wrote: isaacdupree: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Donald Bruce Stewart wrote: Lambdabot uses 1) type guarantee of no-IO at the top level, along with 2) a trusted module base (pure module only, that are

[Haskell-cafe] Bug in GADT Implementation?

2007-05-26 Thread Dominic Steinitz
I would expect foo r@(Range BITSTRING _ _) x = [] to give an error but it doesn't. Writing t = Range BITSTRING gives one so why not the pattern match? Dom. data BitString = BitString [Bool] deriving Show data ConstrainedType :: * - * where INTEGER :: ConstrainedType Int

[Haskell-cafe] problem reading /proc/interrupts with ByteString

2007-05-26 Thread Leandro Lisboa Penz
Hi I'm having some problems using ByteString.Char8.readFile to read /proc/interrupts. I reads nothing. I guess maybe that's because the file is sort of special, but I could read it by opening and using ByteString.Char8.hGetContents. The part of interest is: findInterrupts :: B.ByteString

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Donald Bruce Stewart wrote: The #haskell people have been working on this for about 3 years now. The result is the 'runplugs' program, which I've talked about in previous mails. http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/RunPlugs.hs It uses hs-plugins for the evaluation, along

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Neil Mitchell
HI For me, the unfortunate thing is that there seems to be no interpreter for Haskell written in Haskell. (Except for GHC, which is *huge*.) What do you mean by *huge*? Takes up to much memory at runtime? Requires too long to compile? Has had too many experts spending lots of time writing it?

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Neil Mitchell wrote: HI For me, the unfortunate thing is that there seems to be no interpreter for Haskell written in Haskell. (Except for GHC, which is *huge*.) What do you mean by *huge*? Takes up to much memory at runtime? Requires too long to compile? Has had too many experts spending

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Rodrigo Queiro
As far as I know, hs-plugins works by taking an expression, writing it to a file, calling GHC to parse it, transform it to Core, optimise it, transform it to STG, optimise it, transform it to C--, optimise it, transform it to ANSI C, optimise it, pass it to GCC, compile it, link it, and *then*

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Rodrigo Queiro wrote: As far as I know, hs-plugins works by taking an expression, writing it to a file, calling GHC to parse it, transform it to Core, optimise it, transform it to STG, optimise it, transform it to C--, optimise it, transform it to ANSI C, optimise it, pass

[Haskell-cafe] LUGRadio Live anyone?

2007-05-26 Thread Magnus Therning
Just wondering if anyone else who frequents this list is planning on going to Wolverhampton for LRL in July? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured,

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Stefan O'Rear
On Sat, May 26, 2007 at 07:41:19PM +0100, Andrew Coppin wrote: Donald Bruce Stewart wrote: The #haskell people have been working on this for about 3 years now. The result is the 'runplugs' program, which I've talked about in previous mails.

[Haskell-cafe] Haskell Library on CNN

2007-05-26 Thread Yitzchak Gale
Border conditions in the Haskell Library have finally made the mainstream media: http://www.cnn.com/2007/US/05/26/border.quirk.ap/index.html -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Bug in GADT Implementation?

2007-05-26 Thread Roberto Zunino
Dominic Steinitz wrote: I would expect foo r@(Range BITSTRING _ _) x = [] to give an error but it doesn't. Writing t = Range BITSTRING gives one so why not the pattern match? AFAICS, this is because when you construct a value, as in t, you have to provide the required context (Ord in

[Haskell-cafe] FFI and multi-threading

2007-05-26 Thread Maurí­cio
Do you guys know of a good example of Haskell calling functions to a thread-safe library (like an existing interface to a real library)? I have a function to which I need to alocate memory for each thread calling it, but I don't know how to do that. Thanks, Maurício

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Andrew Coppin
Stefan O'Rear wrote: Actually, there exists no interpreter for Haskell. Period. Haskell has never been implemented. Every implementation has a large collection of corner cases that aren't correctly parsed; these can be recognized as the wontfix bugs. Erm... I'm having a there is no

Re: [Haskell-cafe] Bug in GADT Implementation?

2007-05-26 Thread Dominic Steinitz
Roberto Zunino wrote: Dominic Steinitz wrote: I would expect foo r@(Range BITSTRING _ _) x = [] to give an error but it doesn't. Writing t = Range BITSTRING gives one so why not the pattern match? AFAICS, this is because when you construct a value, as in t, you have to provide the

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Ian Lynagh
On Sat, May 26, 2007 at 08:12:13PM +0100, Andrew Coppin wrote: It's too large and complicated to use for small things. E.g., if you want to just dash off a little something that needs to evaluate an expression... Well, you can use the GHC API. But this is highly nontrivial. You get the

Re: [Haskell-cafe] Bug in GADT Implementation?

2007-05-26 Thread David House
On 26/05/07, Dominic Steinitz [EMAIL PROTECTED] wrote: This seems even worse to me. A is not inhabited so how can 42 be of type A? I think it should work. The context on the F constructor says that A is an instance of Num, so you could only have an F value if you could prove that A was an

[Haskell-cafe] Slower with ByteStrings?

2007-05-26 Thread Jason Dagit
Hello, We recently had a challenge as follows: Given a word, find all the words in the dictionary which can be made from the letters of that word. A letter can be used at most as many times as it appears in the input word. So, letter can only match words with 0, 1, or 2 t's in them. I opted

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Henning Thielemann
On Sat, 26 May 2007, Andrew Coppin wrote: This leaves only the problem of how to make a web server call GHC. I can think of a number of possibilities. - Write my own HTTP server from scratch. (Not keen...) Hacking existing ones is easier:

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-26 Thread Henning Thielemann
On Fri, 25 May 2007, Doug Kirk wrote: What about a public darcs repository where people can constantly download and review modifications? People could even send patches to the authors (editors?). I realise that everyone wants to eat their own dog food, but really, if you want the code

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-26 Thread Henning Thielemann
On Fri, 25 May 2007, Neil Mitchell wrote: http://darcs.haskell.org/darcsweb/darcsweb.cgi?r=yhc;a=summary - most things on haskell.org have a darcsweb, thats the one for Yhc. Nice, I have not seen this before. Not all of my packages at darcs.haskell.org are listed. How can I add more of them?

Re: [Haskell-cafe] Re: CYK-style parsing and laziness

2007-05-26 Thread Steffen Mazanek
Note that there are very systematic and natural ways to derive dynamic programming algorithms in functional languages. In a sense, much of the work of R. Bird centers this topic. The book Algebra of Programming http://web.comlab.ox.ac.uk/oucl/research/pdt/ap/pubs.html#Bird-deMoor96:Algebra

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Neil Mitchell
Hi I don't know about Linux, but Hugs is currently hopelessly unstable on Windoze. Have you filed bugs in the hugs bug tracker? No bugs have been filed from this. In general Windows and Hugs is rock solid, I use it every single day without issue - including to develop Yhc (an compiler). If

[Haskell-cafe] Re: Slower with ByteStrings?

2007-05-26 Thread apfelmus
Jason Dagit wrote: Given a word, find all the words in the dictionary which can be made from the letters of that word. A letter can be used at most as many times as it appears in the input word. So, letter can only match words with 0, 1, or 2 t's in them. I don't know about the ByteString

Re: [Haskell-cafe] Bug in GADT Implementation?

2007-05-26 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David House wrote: On 26/05/07, Dominic Steinitz [EMAIL PROTECTED] wrote: This seems even worse to me. A is not inhabited so how can 42 be of type A? I think it should work. The context on the F constructor says that A is an instance of Num, so

[Haskell-cafe] Re: Bug in GADT Implementation?

2007-05-26 Thread Arie Peterson
Dominic Steinitz wrote: I suppose I could read my example as if there is anything that matches Range BITSTRING _ _ then do the following and since nothing can ever match it then it's a redundant case. But I would expect the compiler to at least warn me that nothing can ever match this. Why

Re: [Haskell-cafe] Slower with ByteStrings?

2007-05-26 Thread Bryan O'Sullivan
Jason Dagit wrote: I think, given my simple algorithm that means that (==) for ByteStrings is slower than (==) for String. Is this possible? Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. For small strings, this loses by a large margin because it has to go through

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
overdrigzed: As far as I know, hs-plugins works by taking an expression, writing it to a file, calling GHC to parse it, transform it to Core, optimise it, transform it to STG, optimise it, transform it to C--, optimise it, transform it to ANSI C,

[Haskell-cafe] System.Timeout problems

2007-05-26 Thread Neil Mitchell
Hi I'm using the System.Timeout module from base, copied into my local repo, so that I can work with GHC 6.6.1. My copy is at: http://www.cs.york.ac.uk/fp/darcs/catch/catch_1/System/TimeoutGHC.hs (but it is identical to the one in base) Sadly, it doesn't seem to work for me. Here are the tests

Re: [Haskell-cafe] problem reading /proc/interrupts with ByteString

2007-05-26 Thread Matthew Brecknell
Leandro Lisboa Penz: I'm having some problems using ByteString.Char8.readFile to read /proc/interrupts. I reads nothing. I guess maybe that's because the file is sort of special, but I could read it by opening and using ByteString.Char8.hGetContents. ByteString.Char8.readFile uses

[Haskell-cafe] Memoization

2007-05-26 Thread Mark Engelberg
I'd like to write a memoization utility. Ideally, it would look something like this: memoize :: (a-b) - (a-b) memoize f gives you back a function that maintains a cache of previously computed values, so that subsequent calls with the same input will be faster. I've searched the web for

Re: [Haskell-cafe] Memoization

2007-05-26 Thread Felipe Almeida Lessa
On 5/26/07, Mark Engelberg [EMAIL PROTECTED] wrote: I don't see any elegant way to do this in Haskell, and I'm doubting its possible. Can someone prove me wrong? Provided some sort of memoize :: (a-b) - (a-b), I'd do something like f = memoize g where g = recursive call to f, not g ...

Re: [Haskell-cafe] Memoization

2007-05-26 Thread Stefan O'Rear
On Sat, May 26, 2007 at 11:41:28PM -0300, Felipe Almeida Lessa wrote: On 5/26/07, Mark Engelberg [EMAIL PROTECTED] wrote: I don't see any elegant way to do this in Haskell, and I'm doubting its possible. Can someone prove me wrong? Provided some sort of memoize :: (a-b) - (a-b), I'd do

Re: [Haskell-cafe] Memoization

2007-05-26 Thread Erik de Castro Lopo
Stefan O'Rear wrote: memofix :: ((a - b) - (a - b)) - a - b memofix ff = let g = memoize (ff g) in g fib = memofix $ \fib k - case k of 0 - 0 1 - 1 n - fib (n-1) + fib (n-2) Stefan, these is something missing here. Where is memoize defined? Erik --

Re: [Haskell-cafe] Memoization

2007-05-26 Thread Felipe Almeida Lessa
On 5/27/07, Stefan O'Rear [EMAIL PROTECTED] wrote: memofix :: ((a - b) - (a - b)) - a - b memofix ff = let g = memoize (ff g) in g fib = memofix $ \fib k - case k of 0 - 0 1 - 1 n - fib (n-1) + fib (n-2) But this way you miss pattern matching and guards? How would you

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
claus.reinke: The #haskell people have been working on this for about 3 years now. The result is the 'runplugs' program, which I've talked about in previous mails. http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/RunPlugs.hs It uses hs-plugins for the evaluation, along with the

Re: [Haskell-cafe] Slower with ByteStrings?

2007-05-26 Thread Donald Bruce Stewart
bos: Jason Dagit wrote: I think, given my simple algorithm that means that (==) for ByteStrings is slower than (==) for String. Is this possible? Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. For small strings, this loses by a large margin because it has to go