[Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Aaron Denney
On 2007-10-12, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Oct 12, 2007, at 17:38 , Lihn, Steve wrote: Installing: --prefix=~/cabal/lib/haddock-0.8/ghc-6.4 This looks suspicious to me: the ~ metacharacter is only understood by shells, and only in certain circumstances (i.e.

[Haskell-cafe] Can every monad can be implemented with Cont? (was: New slogan for haskell.org)

2007-10-13 Thread apfelmus
Don Stewart wrote: allbery: Didn't someone already prove all monads can be implemented in terms of Cont? Cont and StateT, wasn't it? And the schemers have no choice about running in StateT :) You sure? I want to see the proof :) Last time I stumbled upon something like this, the proof

[Haskell-cafe] Re: more functions to evaluate

2007-10-13 Thread Aaron Denney
On 2007-10-12, Dan Weston [EMAIL PROTECTED] wrote: applyNtimes f n | n 0 = f . applyNtimes f (n-1) | otherwise = id Why not some variant of: applyNtimes f n = foldl' (.) id (replicate n f) -- Aaron Denney -- ___ Haskell-Cafe

[Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Jon Fairbairn
Lihn, Steve [EMAIL PROTECTED] writes: Hi, I have been hacking the Haskell installation a few days on Redhat Linux. GHC 6.6 - 6.6.1 - Lambdabot does not work. [...] Anyway, now my question is, how do I thoroughly clean up Haskell? (And maybe try again after a few days of rest.) Is

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread ntupel
On Fri, 2007-10-12 at 20:25 -0700, Stefan O'Rear wrote: On Sat, Oct 13, 2007 at 12:09:57AM +0200, ntupel wrote: setup :: (Ord a, IArray a2 a, IArray a1 e, Num a) = [e] - [a] - (a1 Int e, a1 Int e, a2 Int a) calcAlias :: (Ord e, Num e, IArray a e, Ix i, IArray a2 e1, IArray a1 e1) = a2 i

Re: [Haskell-cafe] WinAmp plugin?

2007-10-13 Thread Peter Verswyvelen
Yes that would be cool. Similarly, Haskell could also be used to create something like http://www.soundspectrum.com/g-force. Would be cool to translate the vector-field code to the GPU, and that has already been done in Haskell (Vertigo?) Conal Elliott wrote: sounds like great fun to me.

Re: [Haskell-cafe] more functions to evaluate

2007-10-13 Thread Rodrigo Queiro
Dan: Sorry, I forgot to Reply to All. On 12/10/2007, Dan Weston [EMAIL PROTECTED] wrote: ... We don't want to make an intermediate list of zeroes and append, since that could be wasteful. Just keep adding a zero to the head of our list until it gets big enough. Our list is not copied (i.e. it

Re: [Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 3:51 , Aaron Denney wrote: On 2007-10-12, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Oct 12, 2007, at 17:38 , Lihn, Steve wrote: Installing: --prefix=~/cabal/lib/haddock-0.8/ghc-6.4 This looks suspicious to me: the ~ metacharacter is only understood by

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 6:52 , ntupel wrote: On Fri, 2007-10-12 at 20:25 -0700, Stefan O'Rear wrote: On Sat, Oct 13, 2007 at 12:09:57AM +0200, ntupel wrote: setup :: (Ord a, IArray a2 a, IArray a1 e, Num a) = [e] - [a] - (a1 Int e, a1 Int e, a2 Int a) calcAlias :: (Ord e, Num e, IArray a e, Ix

Re: [Haskell-cafe] Dual Parser Failure???

2007-10-13 Thread Brent Yorgey
On 10/12/07, PR Stanley [EMAIL PROTECTED] wrote: Hi failure :: (Parser a) failure = \inp - [] The code might contain some syntax errors and I'd be grateful for any corrections. What is a dual parser failure? You should probably put the definition on a separate line, thus: failure ::

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-13 Thread Roberto Zunino
Andrew Coppin wrote: I was actually thinking more along the lines of a programming language where you can just write head :: (n 1) = List n x - x Current GHC can approximate this with a GADT: == {-# OPTIONS -fglasgow-exts #-} module SafeHead where

Re: [Haskell-cafe] Can every monad can be implemented with Cont? (was: New slogan for haskell.org)

2007-10-13 Thread jeff p
Hello, Didn't someone already prove all monads can be implemented in terms of Cont? Cont and StateT, wasn't it? And the schemers have no choice about running in StateT :) You sure? I want to see the proof :) I think this is referring to Andrzej Filinski's paper Representing Layered

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread ntupel
On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote: Now you need to start forcing things; given laziness, things tend to only get forced when in IO, which leads to time being accounted to the routine where the forcing happened. If random / randomR are invoked with large

Re: [Haskell-cafe] Can every monad can be implemented with Cont? (was: New slogan for haskell.org)

2007-10-13 Thread Albert Y. C. Lai
jeff p wrote: I think this is referring to Andrzej Filinski's paper Representing Layered Monads in which it shown that stacks of monads can be implemented directly (no layering) by using call/cc and mutable state. I have been unable to see how to bring its crucial reify and reflect to

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 11:40 , ntupel wrote: On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote: Now you need to start forcing things; given laziness, things tend to only get forced when in IO, which leads to time being accounted to the routine where the forcing happened. If

Re: [Haskell-cafe] Can every monad can be implemented with Cont? (was: New slogan for haskell.org)

2007-10-13 Thread Dan Doel
On Saturday 13 October 2007, Albert Y. C. Lai wrote: jeff p wrote: I think this is referring to Andrzej Filinski's paper Representing Layered Monads in which it shown that stacks of monads can be implemented directly (no layering) by using call/cc and mutable state. I have been unable to

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread ntupel
On Sat, 2007-10-13 at 12:42 -0400, Brandon S. Allbery KF8NH wrote: Your apparently simple StdGen argument is actually a sort of program state (represented by unevaluated thunks, not by a state monad; see below) which gets altered with every invocation of random. If nothing is forced

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 13:30 , ntupel wrote: On Sat, 2007-10-13 at 12:42 -0400, Brandon S. Allbery KF8NH wrote: Your apparently simple StdGen argument is actually a sort of program state (represented by unevaluated thunks, not by a state monad; see below) which gets altered with every invocation

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread ntupel
On Sat, 2007-10-13 at 13:35 -0400, Brandon S. Allbery KF8NH wrote: For starters, look into seq. Try applying it to any expression using a generated random number. This should force evaluation to occur somewhere other than when random is trying to figure out what StdGen value it's been

[Haskell-cafe] do

2007-10-13 Thread PR Stanley
Hi do, what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn bla bla So, what does do, do? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] do

2007-10-13 Thread Henning Thielemann
On Sat, 13 Oct 2007, PR Stanley wrote: Hi do, what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn bla bla So, what does do, do? It's syntactic sugar. http://www.haskell.org/onlinereport/exps.html#sect3.14

Re: [Haskell-cafe] Filesystem questions

2007-10-13 Thread Yitzchak Gale
Andrew Coppin wrote: Is there a way to get rid of . and .. in the results? Brandon S. Allbery wrote: Manual filtering is always required, whether C, Perl, Haskell, etc. I dunno, maybe python filters them for you or something. Correct, Python filters them out. This is clearly the correct

Re: [Haskell-cafe] do

2007-10-13 Thread Luke Palmer
On 10/13/07, PR Stanley [EMAIL PROTECTED] wrote: Hi do, what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn bla bla So, what does do, do? In this example, do doesn't do anything. do doesn't do anything to a single expression (well, I think

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Isaac Dupree
ntupel wrote: Thanks for your reply Stefan. Unfortunately I could measure only a relatively small improvement by changing to concrete types the sample code was about one second faster when compiled with -O2. Profiling again indicated that most time was spend in random and randomR GHC

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Don Stewart
isaacdupree: ntupel wrote: Thanks for your reply Stefan. Unfortunately I could measure only a relatively small improvement by changing to concrete types the sample code was about one second faster when compiled with -O2. Profiling again indicated that most time was spend in random and

Re: [Haskell-cafe] Filesystem questions

2007-10-13 Thread Henning Thielemann
On Sat, 13 Oct 2007, Yitzchak Gale wrote: Andrew Coppin wrote: Is there a way to get rid of . and .. in the results? Brandon S. Allbery wrote: Manual filtering is always required, whether C, Perl, Haskell, etc. I dunno, maybe python filters them for you or something. Correct, Python

Re: [Haskell-cafe] do

2007-10-13 Thread Henning Thielemann
On Sat, 13 Oct 2007, Henning Thielemann wrote: On Sat, 13 Oct 2007, PR Stanley wrote: Hi do, what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn bla bla So, what does do, do? It's syntactic sugar.

Re: [Haskell-cafe] more functions to evaluate

2007-10-13 Thread Derek Elkins
On Fri, 2007-10-12 at 16:20 -0700, Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Maxime Henrion wrote: Isaac Dupree wrote: Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be

Re: [Haskell-cafe] do

2007-10-13 Thread jerzy . karczmarczuk
PR Stanley wrote: Hi do, what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn bla bla So, what does do, do? On Sat, 13 Oct 2007, Henning Thielemann wrote: It's syntactic sugar. http://www.haskell.org/onlinereport/exps.html#sect3.14

Re: [Haskell-cafe] Filesystem questions

2007-10-13 Thread Magnus Therning
On Sat, Oct 13, 2007 at 23:27:13 +0200, Yitzchak Gale wrote: Andrew Coppin wrote: Is there a way to get rid of . and .. in the results? Brandon S. Allbery wrote: Manual filtering is always required, whether C, Perl, Haskell, etc. I dunno, maybe python filters them for you or something.

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread ntupel
On Sat, 2007-10-13 at 14:37 -0700, Don Stewart wrote: I've seen similar results switching to the SIMD mersenne twister C implementation for randoms: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html If there's interest, I can package up the bindings for hackage. I

Re: [Haskell-cafe] do

2007-10-13 Thread PR Stanley
Thanks for the very clear explanation. More questions: What is the role of ? How is different to =? I am aware that = is used for sequencing parsers but that's all I know about it. Thanks, Paul At 22:28 13/10/2007, you wrote: On 10/13/07, PR Stanley [EMAIL PROTECTED] wrote: Hi do, what's

Re: [Haskell-cafe] do

2007-10-13 Thread Luke Palmer
Disclaimer: I'm explaining all of this in terms of actions, which are only one way of looking at monads, and the view only works for certain ones (IO, State, ...). Without futher ado... An action does two things: it has a side-effect and then it has a return value. The type IO Int is an I/O

Re: [Haskell-cafe] do

2007-10-13 Thread Isaac Dupree
Luke Palmer wrote: Using this you can do more complex actions, like, for instance, adding two numbers: readLine = (\x - readLine = (\y - print (x + y))) Take a moment to grok that... Which you might like to write: do x - readLine y - readLine print (x + y) you can

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Isaac Dupree
Don Stewart wrote: I've seen similar results switching to the SIMD mersenne twister C implementation for randoms: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html If there's interest, I can package up the bindings for hackage. looks nice... at least for those of us who

Re: [Haskell-cafe] Filesystem questions

2007-10-13 Thread Bryan O'Sullivan
Yitzchak Gale wrote: Python also has os.walk, a very convenient functional (sort of) tool for recursing through directories. (It sounds trivial, but it is not, there are enough annoying details that this function saves huge amounts of time.) Very embarrassing that Haskell is missing this. See