Re: [Haskell-cafe] parsing c

2008-02-25 Thread Duncan Coutts
On Mon, 2008-02-25 at 03:06 +0100, Bertram Felgenhauer wrote: Evan Martin wrote: So two questions: Is there an alternative C-parsing library? Has anyone looked into librarifying c2hs's parser? I have split c2hs into three packages once, the remains of CTK that it uses, the C parser and

Re[2]: [Haskell-cafe] Graphical graph reduction

2008-02-25 Thread Bulat Ziganshin
Hello dainichi, Monday, February 25, 2008, 2:46:20 AM, you wrote: Jersey. (Sorry, this will probably make me unpopular here on Haskell-cafe, but the ability to use references was just too tempting, and I'm not too experienced with purely functional data structures). we have references,

Re: [Haskell-cafe] haskellwiki and Project Euler

2008-02-25 Thread Daniel Fischer
Am Sonntag, 24. Februar 2008 14:20 schrieb Philippa Cowderoy: (reordered quotes) Other code was submitted without consent of the author Can you demonstrate this? A statement from the author that they didn't consent, for example? Well, some of my code was there, without my consent. That

Re: [Haskell-cafe] placeholders in hsql

2008-02-25 Thread Justin Bailey
I don't know about hsql, but I have some patches that add parametes to haskelldb. I'd be glad to send them along but I couldn't offer much support. 2008/2/24 Roman Cheplyaka [EMAIL PROTECTED]: Is there an ability to use placeholders in SQL statement using hsql? (Actually I'm interested in

Re: [Haskell-cafe] hoogle gtk2hs

2008-02-25 Thread Neil Mitchell
Hi Gour, Emacs haskell-mode has haskell-hoogle function to search Haskell API, but it, unfortunately, does not work with gtk2hs API which can be accessed via web at http://haskell.org/hoogle/?package=gtk Not yet, although hopefully it will be done at some point. For now you can just take

[Haskell-cafe] Re: derivation of mapP, a parallel, lazy map

2008-02-25 Thread Ben Franksen
Dan Zwell wrote: Hello, everyone. I have just written a tutorial (sort of) on Haskell concurrency, ^^^ specifically on the derivation of a function mapP, a parallel version of map. I wrote this because I am fairly new to Haskell, and I didn't realize how easy concurrent code is

Re: [Haskell-cafe] derivation of mapP, a parallel, lazy map

2008-02-25 Thread Felipe Lessa
On Sun, Feb 24, 2008 at 1:45 AM, Dan Zwell [EMAIL PROTECTED] wrote: If anybody is curious to see this, the page is http://zwell.net/content/haskell.html#mapP . I would appreciate any criticism, too. I hope somebody finds this helpful. Have you seen parBuffer? I'd also recommend looking at

[Haskell-cafe] Re: derivation of mapP, a parallel, lazy map

2008-02-25 Thread Ben Franksen
Felipe Lessa wrote: On Sun, Feb 24, 2008 at 1:45 AM, Dan Zwell [EMAIL PROTECTED] wrote: If anybody is curious to see this, the page is http://zwell.net/content/haskell.html#mapP . I would appreciate any criticism, too. I hope somebody finds this helpful. Have you seen parBuffer? I'd also

[Haskell-cafe] Computational Category Theory in Haskell

2008-02-25 Thread Dan Weston
Has anyone already ported to Haskell the ML code in Rydeheard and Burstall, Computational Category Theory? Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Graphical graph reduction

2008-02-25 Thread Taral
On 2/24/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: (define nth (lambda (n xs) (if (= n 0)(head xs)(nth (- n 1) (tail xs) nth n (x:xs) = if n == 0 then x else nth (n-1) xs I'm guessing it's some kind of lisp variant? (define nth (lambda (n xs) (cond ((consp xs) (if (= n 0) (head xs)

Re: [Haskell-cafe] derivation of mapP, a parallel, lazy map

2008-02-25 Thread Roberto Zunino
Felipe Lessa wrote: Have you seen parBuffer? I'd also recommend looking at its source. I wonder if it would be possible to make a variant of parBuffer so that the following evaluates to 1: take 1 $ parBuffer 10 r0 (1:2:3:undefined) *** Exception: Prelude.undefined Maybe we should use a

Re: [Haskell-cafe] derivation of mapP, a parallel, lazy map

2008-02-25 Thread Dan Weston
According to Lennart Augustsson (http://haskell.org/pipermail/haskell-cafe/2007-July/029603.html) you can have uninterruptible threads in ghc. If a thread never allocates it will never be preempted. So I wonder if what you are proposing really is unsafe because by the time (take 1) is even

[Haskell-cafe] Using template haskell to create pseudo columns

2008-02-25 Thread Justin Bailey
Adding pseudo columns to a projection is cumbersome, to say the list. For example, to add a field named hidden to a query I have to write: data Hide = Hide instance FieldTag Hide where fieldName _ = hide hideField = mkAttr Hide I wrote a little Template haskell that reduces this to:

Re: [Haskell-cafe] Computational Category Theory in Haskell

2008-02-25 Thread Derek Elkins
On Mon, 2008-02-25 at 12:27 -0800, Dan Weston wrote: Has anyone already ported to Haskell the ML code in Rydeheard and Burstall, Computational Category Theory? This isn't very helpful, but I did several years ago, but I've since lost the code. It's straightforward if tedious to do.

[Haskell-cafe] noob question

2008-02-25 Thread Ben
I'm just starting to learn Haskell, and I'm having some confusion (I think) with how the type inference is working. Can someone explain why, in ghc 6.8.2 this works: *Main (1/3)^3 3.7037037037037035e-2 But this doesn't *Main (\k - (1/k) ^ k) 3 interactive:1:8: Ambiguous type variable

[Haskell-cafe] Graphical graph reduction

2008-02-25 Thread Mike Thyer
Kai wrote: Thank you all for showing interest and responding. Check out http://thyer.name/lambda-animator/. Requires Java. Wow, this is SUCH a cool tool. Best discovery in a long time! I think I need to brush up on my lambda-calculus, because it took me some time to figure out what settings

Re: [Haskell-cafe] noob question

2008-02-25 Thread Philippa Cowderoy
On Mon, 25 Feb 2008, Ben wrote: interactive:1:8: Ambiguous type variable `t' in the constraints: `Fractional t' arising from a use of `/' at interactive:1:8-10 `Integral t' arising from a use of `^' at interactive:1:7-15 Probable fix: add a type signature that fixes these

Re: [Haskell-cafe] noob question

2008-02-25 Thread Ben
On Feb 25, 2008, at 4:11 PM, Philippa Cowderoy wrote: On Mon, 25 Feb 2008, Ben wrote: interactive:1:8: Ambiguous type variable `t' in the constraints: `Fractional t' arising from a use of `/' at interactive:1:8-10 `Integral t' arising from a use of `^' at interactive:1:7-15

Re: [Haskell-cafe] noob question

2008-02-25 Thread Daniel Fischer
To elaborate on what Philippa said, the thing that probably is at the basis of your confusion is the fact that integer *literals* are overloaded (actually, the literal 3 means fromInteger 3, where the result type of different fromInteger calls in the same expression need not be the same). So if

Re: [Haskell-cafe] noob question

2008-02-25 Thread Daniel Fischer
Am Dienstag, 26. Februar 2008 01:32 schrieb Ben: Ok, that makes sense. There's no num k that's both Fractional and Integral, where as in the case where I had the number literals, those were two different instances. What's the usual way of working around this? Something like (\k - (1/

Re: [Haskell-cafe] Computational Category Theory in Haskell

2008-02-25 Thread jerzy . karczmarczuk
Derek Elkins writes: Dan Weston wrote: Has anyone already ported to Haskell the ML code in Rydeheard and Burstall, Computational Category Theory? This isn't very helpful, but I did several years ago, ... You might be interested by: On the expressive power of Constructor Classes by Luc

Re: [Haskell-cafe] noob question

2008-02-25 Thread Don Stewart
thefunkslists: I'm just starting to learn Haskell, and I'm having some confusion (I think) with how the type inference is working. Can someone explain why, in ghc 6.8.2 this works: *Main (1/3)^3 3.7037037037037035e-2 But this doesn't *Main (\k - (1/k) ^ k) 3

Re: [Haskell-cafe] noob question

2008-02-25 Thread Ryan Ingram
You can also do something like this (assuming -fglasgow-exts or LANGUAGE Rank2Types): f :: forall b. Fractional b = (forall a. Num a = a) - b f x = (1/x)^x This says that the argument to f has to be able to be instantiated at any numeric type, such as the result of a call to fromInteger. Now,

Re: [Haskell-cafe] derivation of mapP, a parallel, lazy map

2008-02-25 Thread Dan Zwell
Felipe Lessa wrote: On Sun, Feb 24, 2008 at 1:45 AM, Dan Zwell [EMAIL PROTECTED] wrote: If anybody is curious to see this, the page is http://zwell.net/content/haskell.html#mapP . I would appreciate any criticism, too. I hope somebody finds this helpful. Have you seen parBuffer? I'd also

Re: [Haskell-cafe] derivation of mapP, a parallel, lazy map

2008-02-25 Thread Felipe Lessa
On Tue, Feb 26, 2008 at 12:49 AM, Dan Zwell [EMAIL PROTECTED] wrote: Clearly using parBuffer would be a win on machines with lots of CPUs, but is there any reason that I would want to use it instead of the mapP I've already defined? You certainly don't want the end user to modify a lot of

Re: [Haskell-cafe] noob question

2008-02-25 Thread Henning Thielemann
On Tue, 26 Feb 2008, Philippa Cowderoy wrote: On Mon, 25 Feb 2008, Ben wrote: interactive:1:8: Ambiguous type variable `t' in the constraints: `Fractional t' arising from a use of `/' at interactive:1:8-10 `Integral t' arising from a use of `^' at interactive:1:7-15

Re: [Haskell-cafe] noob question about powers

2008-02-25 Thread Henning Thielemann
On Tue, 26 Feb 2008, Daniel Fischer wrote: Am Dienstag, 26. Februar 2008 01:32 schrieb Ben: Ok, that makes sense. There's no num k that's both Fractional and Integral, where as in the case where I had the number literals, those were two different instances. What's the usual way of