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
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
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
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/
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:
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.
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 somet
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
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 so
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.
http://www.haskell.org/onlinereport/e
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 f
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
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 StdGen'
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,
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 correc
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
___
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
http://www.haskell.org/mailman/listinfo/
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 b
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
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
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
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 rando
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 Ha
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 larg
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 "Re
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 w
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:
failur
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, I
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
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.
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. i'll
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)
"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.
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-
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"
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 circumsta
36 matches
Mail list logo