Re: [Haskell-cafe] Re: Haskell Weekly News: Issue 137 - October 31, 2009

2009-11-02 Thread Max Rabkin
On Mon, Nov 2, 2009 at 6:42 AM, Benjamin L.Russell dekudekup...@yahoo.com wrote: Hey, careful now No need to start another Emacs vs. the other 'editor' flamewar ... lest someone run M-x nethack and summon a Demogorgon against you ... er, make that M-x haskellhack, since a Haskell version

Re: [Haskell-cafe] Bulding a library for C users on OS X

2009-11-02 Thread Chris Eidhof
On 2 nov 2009, at 03:30, Manuel M T Chakravarty wrote: Chris Eidhof: I'm trying to call a Haskell function from C, on OS X. There's an excellent post [1] by Tomáš Janoušek that explains how to do this on Linux. However, on OS X, it's different. First of all, it looks like the -no-hs-main

RE: [Haskell-cafe] Bulding a library for C users on OS X

2009-11-02 Thread Simon Peyton-Jones
There is some stuff on using the FFI under Collaborative documentation at http://haskell.org/haskellwiki/GHC. The FFI link takes you to http://haskell.org/haskellwiki/GHC/Using_the_FFI It's called collaborative because it's When you solve your problem, can I urge you to update that page (its

Re: [Haskell-cafe] Re: ANN: haskell-mode 2.6

2009-11-02 Thread Roel van Dijk
Thanks for the update. I am using it now and am very happy with it! No more tabtabtabtabtab to properly indent something. I did notice a bug in the declaration scanning part. Blocks of haddock comments are parsed as code. Code like this: {-| bla bla bla -} will be parsed as a variable bla. If

Re: [Haskell-cafe] Simple FAST lazy functional primes

2009-11-02 Thread Bulat Ziganshin
Hello Will, Monday, November 2, 2009, 10:41:15 AM, you wrote: (testing was done running the ghc -O3 compiled code inside GHCi). afaik, -O2 should be used -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___

Re: [Haskell-cafe] hackage is down.

2009-11-02 Thread Jochem Berndsen
??? ?? wrote: No no no! Why not download the normal (signed) cabal list from the DHT (and optionally directly from hackage.haskell.org)? These are all the packages that would appear on the website. Why serve any other content? All nodes in the DHT may check and make sure the file

Re: [Haskell-cafe] Re: ANN: haskell-mode 2.6

2009-11-02 Thread Dan Doel
On Sunday 01 November 2009 4:45:58 pm Svein Ove Aas wrote: On Sun, Nov 1, 2009 at 8:20 PM, Svein Ove Aas svein@aas.no wrote: Fellow haskellers: Haskell-mode 2.6 has been released. Make that 2.6.1. Naturally, I broke something, but I think I'm about out of things to break now. As it

Re: [Haskell-cafe] Re: Haskell Weekly News: Issue 137 - October 31, 2009

2009-11-02 Thread Joe Fredette
It's not my fault you emacs-y people chose the wrong editor... :) /Joe On Nov 1, 2009, at 11:42 PM, Benjamin L.Russell wrote: On Fri, 30 Oct 2009 21:38:25 -0700 (PDT), jfred...@gmail.com wrote: ... a new version of haskell-mode for the lesser of two editors

Re: [Haskell-cafe] Simple FAST lazy functional primes

2009-11-02 Thread Sjoerd Visscher
You can remove the take k step by passing along the list of primes smaller than p instead of k: primes = 2 : 3 : 5 : 7 : sieve [3, 2] (drop 2 primes) sieve qs@(q:_) (p:ps) = [x | x-[q*q+2,q*q+4..p*p-2], and [(x`rem`p)/=0 | p-qs]] ++ sieve (p:qs) ps I also removed the x

Re: [Haskell-cafe] Re: ANN: haskell-mode 2.6

2009-11-02 Thread Roel van Dijk
I also thought of some font-lock symbols you could consider adding to haskell-font-lock.el: ;; Nice bottom symbol (cons undefined (decode-char 'ucs #X22A5)) ;; Small case pi symbol (cons pi (decode-char 'ucs #X3C0)) ;; This one is less serious (cons unsafePerformIO (decode-char 'ucs #X2620)) I

Re: [Haskell-cafe] AND/OR Perceptron

2009-11-02 Thread Ryan Ingram
I suppose I wasn't entirely clear. where is syntactic sugar for let...in, pattern matching is syntactic sugar for case, and guards are syntactic sugar for if..then..else and/or case (for pattern guards) In fact, the whole reason for the existence of where is so that it can attach at a

Re: [Haskell-cafe] Re: ANN: haskell-mode 2.6

2009-11-02 Thread Svein Ove Aas
On Mon, Nov 2, 2009 at 1:18 PM, Dan Doel dan.d...@gmail.com wrote: On Sunday 01 November 2009 4:45:58 pm Svein Ove Aas wrote: On Sun, Nov 1, 2009 at 8:20 PM, Svein Ove Aas svein@aas.no wrote: Fellow haskellers: Haskell-mode 2.6 has been released. Make that 2.6.1. Naturally, I broke

[Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Will Ness
Sjoerd Visscher sjoerd at w3future.com writes: [...] 2 doesn't have to be in the list of smaller primes, as we're only generating odd numbers: primes = 2 : 3 : 5 : 7 : sieve [3] (drop 2 primes) sieve qs@(q:_) (p:ps) = [x | x-[q*q+2,q*q+4..p*p-2], and [(x`rem`p)/=0 | p-qs]]

[Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Will Ness
Will Ness will_n48 at yahoo.com writes: But more importantly I want it to be known that there's a lot that can be done here, in a natural functional lazy kind of way, before resorting to priority queues and mutable arrays. We could always just use C too. ;) I mean it as an introductory code

Re: [Haskell-cafe] Using HaskellDB on Tables that contain same column names

2009-11-02 Thread Justin Bailey
I'd recommend sending HaskellDB questions to the haskelldb users mailing list. You do need to subscribe first. Now to your question: On Sat, Oct 31, 2009 at 2:38 AM, R. Emre Başar r...@cs.bilgi.edu.tr wrote: Hi all, project (Server.name s!Server.name #         Vendor.name v!Vendor.name #    

[Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Will Ness
Sjoerd Visscher sjoerd at w3future.com writes: Excuse me, 2 doesn't have to be in the list of smaller primes, as we're only generating odd numbers: primes = 2 : 3 : 5 : 7 : sieve [3] (drop 2 primes) sieve qs@(q:_) (p:ps) = [x | x-[q*q+2,q*q+4..p*p-2], and [(x`rem`p)/=0 | p-qs]]

[Haskell-cafe] Re: Experiments with defunctionalization, church-encoding and CPS

2009-11-02 Thread Heinrich Apfelmus
David Menendez wrote: Heinrich Apfelmus wrote: David Menendez wrote: Heinrich Apfelmus wrote: Even then, the results are mixed. The Church-encoding shines in GHCi as it should, but loses its advantage when the code is being compiled. I guess we have to look at the core if we want to know

Re: [Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Sjoerd Visscher
On Nov 2, 2009, at 5:11 PM, Will Ness wrote: Sjoerd Visscher sjoerd at w3future.com writes: Excuse me, 2 doesn't have to be in the list of smaller primes, as we're only generating odd numbers: primes = 2 : 3 : 5 : 7 : sieve [3] (drop 2 primes) sieve qs@(q:_) (p:ps) = [x |

Re: [Haskell-cafe] Re: ANN: haskell-mode 2.6

2009-11-02 Thread Svein Ove Aas
On Mon, Nov 2, 2009 at 4:18 PM, Svein Ove Aas svein@aas.no wrote: I'm going to try teaching it. Hopefully I won't break anything in the process. I have so taught. If you grab the latest darcs version, it should work. However, I won't be releasing this without further testing, so if you do

[Haskell-cafe] Re: Base classes can be _ELIMINATED_ with interfaces

2009-11-02 Thread Will Ness
Shelby Moore shelby at coolpage.com writes: * 1856 Thermo Law: entire universe (a closed system, i.e. everything) trends to maximum disorder. On the very, *very*, VERY long timescale. In the meantime, chaos creates clashes of matter, which cause local energy outbursts (i.e. galaxies),

[Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread Patai Gergely
Hello all, I wanted to create a weak pointer with an IORef as the key and something else as the value, but I saw no way to do it through the API provided. After some experimentation I came up with the following abomination for a solution: myWeakRef (IORef (STRef r)) v f = IO $ \s - case

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread John Van Enk
Is the IORef or the value in the IORef your key? 2009/11/2 Patai Gergely patai_gerg...@fastmail.fm Hello all, I wanted to create a weak pointer with an IORef as the key and something else as the value, but I saw no way to do it through the API provided. After some experimentation I came up

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread Patai Gergely
Is the IORef or the value in the IORef your key? I want the IORef itself to be the key. However, that doesn't work with optimisations turned on (the pointers get wiped out at the first gc), I guess because they remove the box around the MutVar#. Extracting that MutVar# seems to solve the problem.

[Haskell-cafe] Hackage still down?

2009-11-02 Thread Magnus Therning
It seems to have been down for at least the better part of today. Is it something worth worrying about? /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

Re: [Haskell-cafe] Hackage still down?

2009-11-02 Thread Don Stewart
magnus: It seems to have been down for at least the better part of today. Is it something worth worrying about? Summarising what we know: * The machine that hosts darcs.haskell.org and hackage.haskell.org, has an increasing number of uncorrectable errors on its RAID drives.

Re: [Haskell-cafe] Hackage still down?

2009-11-02 Thread Gregory Crosswhite
Of *course* your hard drives are getting damaged --- everyone knows that Raid only works on *real* bugs, not software bugs! Spraying it on your hard drives to improve the quality of the libraries on Hackage is just silly! - Greg On Nov 2, 2009, at 10:45 AM, Don Stewart wrote: magnus:

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread Job Vranish
Could mkWeakPair do what you want? http://haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#v:mkWeakPair Or are you trying to do something else? - Job 2009/11/2 Patai Gergely patai_gerg...@fastmail.fm Hello all, I wanted to create a weak pointer with an IORef as the key

Re: [Haskell-cafe] Hackage still down?

2009-11-02 Thread Magnus Therning
On Mon, Nov 2, 2009 at 7:45 PM, Don Stewart d...@galois.com wrote: magnus: It seems to have been down for at least the better part of today.  Is it something worth worrying about? Summarising what we know:    * The machine that hosts darcs.haskell.org and      hackage.haskell.org, has an

Re: [Haskell-cafe] Applicative but not Monad

2009-11-02 Thread Dan Weston
Obviously you know what your talking about and I don't, so this is a question purely out of ignorance. It seems to me that Tomorrow cannot be parametrically polymorphic, or else I could wrap it again (Tomorrow (Tomorrox x)). An unwrapping fixpoint operator needs to reflect the type to know

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread Patai Gergely
Could mkWeakPair do what you want? http://haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#v:mkWeakPair No, it's just a convenience function that doesn't help much, because the value already refers to the IORef anyway. Here's a minimal example to illustrate the problem:

Re: [Haskell-cafe] Re: Haskell Weekly News: Issue 137 - October 31, 2009

2009-11-02 Thread Andrew Coppin
Benjamin L.Russell wrote: Hey, careful now No need to start another Emacs vs. the other 'editor' flamewar ... lest someone run M-x nethack and summon a Demogorgon against you ... er, make that M-x haskellhack, since a Haskell version needs to be created. ;-) Yes, because nobody truly

[Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Will Ness
Will Ness will_n48 at yahoo.com writes: primes = 2: 3: sieve 0 primes' 5 primes' = tail primes sieve k (p:ps) x = [x | x - [x,x+2..p*p-2], and [(x`rem`p)/=0 | p - take k primes']] ++ sieve (k+1) ps (p*p+2) (thanks to Leon P.Smith for his brilliant

Re: [Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Jason Dagit
On Mon, Nov 2, 2009 at 1:59 PM, Will Ness will_...@yahoo.com wrote: Will Ness will_n48 at yahoo.com writes: primes = 2: 3: sieve 0 primes' 5 primes' = tail primes sieve k (p:ps) x = [x | x - [x,x+2..p*p-2], and [(x`rem`p)/=0 | p - take k primes']]

[Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Will Ness
Jason Dagit dagit at codersbase.com writes: On Mon, Nov 2, 2009 at 1:59 PM, Will Ness will_n48 at yahoo.com wrote: Will Ness will_n48 at yahoo.com writes: One _crucial_ tidbit I've left out: _type_signature_. Adding (:: [Int]) speeds this code up more than TWICE! :) :) If you are okay

Re: [Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Felipe Lessa
On Mon, Nov 02, 2009 at 02:10:12PM -0700, Jason Dagit wrote: If you are okay with Int, then maybe you're also happy with Int32 or Word32. If so, why don't you use template haskell to build the list at compile time? If you do that, then getting the kth prime at run-time is O(k). Take that

Re: [Haskell-cafe] Re: Suggested algorithm to control upper bound of space leaks

2009-11-02 Thread Shelby Moore
Simon Marlow replied: http://www.haskell.org/pipermail/cvs-ghc/2009-November/050946.html = Also I received privately a very much appreciated and stimulating reply about the convolution of the competition for the shared resources in the external state machine. My quick (not deeply

Re: [Haskell-cafe] Re: Suggested algorithm to control upper bound of space leaks

2009-11-02 Thread Shelby Moore
stimulating reply about the convolution of the competition for the shared resources in the external state machine. Apparently the concurrency problem is potentially convolved with external state in much more convoluted and intertwinded spaghetti:

Re: [Haskell-cafe] Base classes can be _ELIMINATED_ with interfaces

2009-11-02 Thread Shelby Moore
Shelby Moore wrote: ...A type class is a polymorphic (relative to data type) interface, and the polymorphism is strictly parameterized for the client/consumer of the interface, i.e. the data type is known to the function that inputs the interface AT COMPILE TIME. ...A problem with virtual

Re: [Haskell-cafe] Re: Simple FAST lazy functional primes

2009-11-02 Thread Jason Dagit
On Mon, Nov 2, 2009 at 2:40 PM, Will Ness will_...@yahoo.com wrote: Jason Dagit dagit at codersbase.com writes: On Mon, Nov 2, 2009 at 1:59 PM, Will Ness will_n48 at yahoo.com wrote: Will Ness will_n48 at yahoo.com writes: One _crucial_ tidbit I've left out: _type_signature_. Adding

[Haskell-cafe] advice for dispatch question

2009-11-02 Thread John Lato
Hello, I've been thinking about a problem recently, and would like to know if there are any recommendations for a solution. I have two container-like type classes, defined as follows: import Control.Monad type family ElemOf c :: * type family MonadOf c :: * - * class PureContainer c where

Re: [Haskell-cafe] Re: Base classes can be _ELIMINATED_ with interfaces

2009-11-02 Thread Shelby Moore
Shelby Moore writes: * 1856 Thermo Law: entire universe (a closed system, i.e. everything) trends to maximum disorder. Will Ness wrote: On the very, *very*, VERY long timescale. I love your ascii art :) Note I put it last in the list for reason. Not to be combative, but your statement

[Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Magicloud Magiclouds
Hi, Say I have something like this: [ Record { item = A1, value = 0 } , Record { item = B1, value = 13 } , Record { item = A2, value = 2 } , Record { item = B2, value = 10 } ] How to convert it into: [ XXInfo { name = A, value1 = 0, value2 = 2 } , XXInfo { name = B, value1 = 13, value2 = 10 }

Re: [Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Daniel Fischer
Am Dienstag 03 November 2009 02:29:56 schrieb Magicloud Magiclouds: Hi, Say I have something like this: [ Record { item = A1, value = 0 } , Record { item = B1, value = 13 } , Record { item = A2, value = 2 } , Record { item = B2, value = 10 } ] How to convert it into: [ XXInfo { name =

Re: [Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Evan Laforge
On Mon, Nov 2, 2009 at 5:29 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  Say I have something like this: [ Record { item = A1, value = 0 } , Record { item = B1, value = 13 } , Record { item = A2, value = 2 } , Record { item = B2, value = 10 } ]  How to convert it

[Haskell-cafe] ANN: BlogLiterately-0.2

2009-11-02 Thread Robert Greayer
Due to overwhelming popular demand*, BlogLiterately (version 0.2) has been released on Hackage. It's a simple tool for uploading posts written in markdown and (optionally) literate Haskell to web logs. It relies heavily on Pandoc for markdown processing, but adds a few twists like syntax