[Haskell-cafe] build problems on Hackage

2009-02-05 Thread Wolfgang Jeltsch
Hello all, alas, I couldn’t found any information about who is responsible for the build system on Hackage. So I address this issue to all of you. type-level built fine with GHC 6.8 but failed to build with GHC 6.10. The last line of the build log is this: haddock: internal Haddock or GHC

[Haskell-cafe] Re: Monad explanation

2009-02-05 Thread Benjamin L . Russell
On Wed, 4 Feb 2009 21:43:04 -0800, Max Rabkin max.rab...@gmail.com wrote: On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell dekudekup...@yahoo.com wrote: Is it possible to write a self-referential function in Haskell that modifies itself? Is it possible to write *any* kind of function in

Re: [Haskell-cafe] Re: Monad explanation

2009-02-05 Thread Daryoush Mehrtash
Can someone compare/contrast functions and computation? thanks daryoush On Thu, Feb 5, 2009 at 1:38 AM, Benjamin L. Russell dekudekup...@yahoo.comwrote: On Wed, 4 Feb 2009 21:43:04 -0800, Max Rabkin max.rab...@gmail.com wrote: On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Yitzchak Gale
Manlio Perillo wrote: I'm looking for an exact integer division that avoids overflows, if possible. Richard O'Keefe wrote: What this sounds like to me is a request that the Prelude function 'fromRational' should work well... If you cannot divide two Integers n, d accurately using

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Yitzchak Gale
Manlio Perillo wrote: By the way, in GHC.Float there is a (private): integerLogBase :: Integer - Integer - Int Yes, I have needed this function many times. Too bad it is not exposed. In this case, though, we only need base 2. For that, it would be nice if we could just read it directly from

RE: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Simon Peyton-Jones
| Manlio Perillo wrote: | By the way, in GHC.Float there is a (private): | integerLogBase :: Integer - Integer - Int | | Yes, I have needed this function many times. | Too bad it is not exposed. So use the libraries process to propose exposing it! Simon

[Haskell-cafe] Define variable types

2009-02-05 Thread Tsunkiet Man
Hello, I'm new to Haskell and it seems like a very nice language to learn. However I'm not really familiar with the errormessages it produces. I am using a Helium interpreter. I've created the following module (however it is just a small sketch). I've written the following code: fac :: Int - Int

[Haskell-cafe] Crash using GHCi and GHC API under Windows

2009-02-05 Thread Peter Verswyvelen
We have a program that uses the GHC API to dynamically compile and run new code. We're using GHC 6.10.1 Under GHCi it works fine under OSX, but when running it on Windows, I get Loading package ghc-prim ... GHCi runtime linker: fatal error: I found a duplicate definition for symbol

Re: [Haskell-cafe] Define variable types

2009-02-05 Thread Daniel Fischer
Am Donnerstag, 5. Februar 2009 12:37 schrieb Tsunkiet Man: Hello, I'm new to Haskell and it seems like a very nice language to learn. However I'm not really familiar with the errormessages it produces. I am using a Helium interpreter. I've created the following module (however it is just a

[Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Ross Paterson
On Thu, Feb 05, 2009 at 10:41:20AM +0100, Wolfgang Jeltsch wrote: type-level built fine with GHC 6.8 but failed to build with GHC 6.10. The last line of the build log is this: haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing Yes, haddock 2.4.1 (the most recent release) bombs

Re: [Haskell-cafe] Define variable types

2009-02-05 Thread Miguel Mitrofanov
Note also that Helium ISN'T Haskell; it lacks hell of a lot of Haskell98 features (not to mention common extensions). 05.02.09, 14:57, Roman Cheplyaka r...@ro-che.info: * Tsunkiet Man temp.t...@gmail.com [2009-02-05 12:37:22+0100] Hello, I'm new to Haskell and it seems like a very nice

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Manlio Perillo
Yitzchak Gale ha scritto: [...] Suppose we have a function decodeIntegerAsFloat :: RealFloat a = Integer - (Integer,a) such that if (s,m) = decodeIntegerAsFloat x then either x = 0 and s = 0 and m = 0 or x = m * 2**s (mathematically) and abs m \in [0.5,1.0). Yes, that is what

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Manlio Perillo
Richard O'Keefe ha scritto: On 5 Feb 2009, at 10:38 am, Manlio Perillo wrote: I'm looking for an exact integer division that avoids overflows, if possible. What this sounds like to me is a request that the Prelude function 'fromRational' should work well. Just found that it actually

Re: [Haskell-cafe] Define variable types

2009-02-05 Thread Roel van Dijk
This is not really an answer to your question, but I think you could write a slightly more efficient function to calculate the binomial coefficient: fac :: Integer - Integer fac n = product [1..n] -- |Product of all positive integers less than or equal to n but -- larger than s facFrom ::

Re: [Haskell-cafe] Define variable types

2009-02-05 Thread Roman Cheplyaka
* Tsunkiet Man temp.t...@gmail.com [2009-02-05 12:37:22+0100] Hello, I'm new to Haskell and it seems like a very nice language to learn. However I'm not really familiar with the errormessages it produces. I am using a Helium interpreter. I've created the following module (however it is just

Re: [Haskell-cafe] Define variable types

2009-02-05 Thread Martijn van Steenbergen
Hallo Tsunkiet, Looking at http://www.cs.uu.nl/wiki/bin/view/Helium/ATourOfTheHeliumPrelude it seems you're looking for the /. operator, which is division on floating points. The / you're using only works on integers. Groetjes, Martijn. Tsunkiet Man wrote: Hello, I'm new to Haskell

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Manlio Perillo
Jonathan Cast ha scritto: On Thu, 2009-02-05 at 01:10 +0100, Manlio Perillo wrote: Yitzchak Gale ha scritto: In our case, the Python division first does a quick estimate of the sizes of the two integers, and just returns zero if it sees that there will be underflow on conversion to double. So

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Neil Mitchell
Hi Successor as in Happstack replaces HAppS entirely and all projects implemented in HAppS should aim to port to Happstack - or successor as in builds on the ideas in HAppS? Is HAppS now deprecated? Thanks Neil 2009/2/4 Matthew Elder m...@mattelder.org: Hello Haskell Cafe, I just wanted to

Re: [Haskell-cafe] Bytestrings vs String? parameters within package names?

2009-02-05 Thread Henning Thielemann
---BeginMessage--- Marc Weber wrote: the cabal file: flag bytestring Default: False Description: enable this to use Bytestrings everywhere instead of strings [... now libs and executables: ...] if flag(bytestring) cpp-options: -DUSE_BYTESTRING No, it's a very

Re: [Haskell-cafe] Purely funcional LU decomposition

2009-02-05 Thread Henning Thielemann
---BeginMessage--- Rafael Gustavo da Cunha Pereira Pinto wrote: interesting to look at real matrix code that people have written and think about what would be needed in a library to make it easier to write. -- Dan What I miss most is a data structure with O(1) (amortized)

Re: [Haskell-cafe] Purely funcional LU decomposition

2009-02-05 Thread Henning Thielemann
---BeginMessage--- Paulo Tanimoto wrote: Pretty cool, thanks for releasing this into the wild. I remember looking into this about a year ago. By the way, have you seen Matt's DSP library? http://haskelldsp.sourceforge.net/ He's got LU and others in there, if my memory serves me. The last

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Wolfgang Jeltsch
Am Donnerstag, 5. Februar 2009 13:16 schrieb Ross Paterson: On Thu, Feb 05, 2009 at 10:41:20AM +0100, Wolfgang Jeltsch wrote: type-level built fine with GHC 6.8 but failed to build with GHC 6.10. The last line of the build log is this: haddock: internal Haddock or GHC error:

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread David Waern
2009/2/5 Ross Paterson r...@soi.city.ac.uk: On Thu, Feb 05, 2009 at 10:41:20AM +0100, Wolfgang Jeltsch wrote: type-level built fine with GHC 6.8 but failed to build with GHC 6.10. The last line of the build log is this: haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing Yes,

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Ross Paterson
On Thu, Feb 05, 2009 at 03:05:44PM +0100, David Waern wrote: In Haddock 2.4.0 we switched from using the compilation mode of the GHC API to a mode which does only typchecking. This broke Template Haskell support: http://trac.haskell.org/haddock/ticket/68 The problem is fixed in Haddock

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Jochem Berndsen
Neil Mitchell wrote: Successor as in Happstack replaces HAppS entirely and all projects implemented in HAppS should aim to port to Happstack - or successor as in builds on the ideas in HAppS? Is HAppS now deprecated? The HAppS project has been abandoned, see

[Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Peter Verswyvelen
I'm trying to switch from HG to Darcs, but I'm failing miserably in getting the same productivity. I often do bad checkins with Darcs, merely because the amount of information I get from Darcs is overwhelming and I don't have time to read the details of the large set of commands. With Mercurial,

Re: [Haskell-cafe] Re: Purely funcional LU decomposition

2009-02-05 Thread Michael D. Adams
On Wed, Feb 4, 2009 at 2:15 AM, Neal Alexander wqeqwe...@hotmail.com wrote: Array is no good man! Quad Tree matrices perform much nicer from what I've seen. I've co-authored a paper on that topic (Seven at one stroke: results from a cache-oblivious paradigm for scalable matrix algorithms

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread David Waern
2009/2/5 Ross Paterson r...@soi.city.ac.uk: On Thu, Feb 05, 2009 at 03:05:44PM +0100, David Waern wrote: In Haddock 2.4.0 we switched from using the compilation mode of the GHC API to a mode which does only typchecking. This broke Template Haskell support:

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Ross Paterson
On Thu, Feb 05, 2009 at 03:03:35PM +0100, Wolfgang Jeltsch wrote: Am Donnerstag, 5. Februar 2009 13:16 schrieb Ross Paterson: On Thu, Feb 05, 2009 at 10:41:20AM +0100, Wolfgang Jeltsch wrote: type-level built fine with GHC 6.8 but failed to build with GHC 6.10. The last line of the

[Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
I think I've just about got monads figured out, but there's one detail that still escapes me. As I understand it, a monad is a kind of programming trick the uses data dependency to force evaluation order. x = f means apply f to x; since the value of f x depends on the value of x, the evaluator

[Haskell-cafe] Fastest regex package?

2009-02-05 Thread Eugene Kirpichov
Hello. What is the fastest regex package of the multitude of packages present on Hackage (namely, PCRE, PCRE-light, DFA, TDFA and many more)? My benchmark (parsing a huge logfile with a regex like GET /foo.xml.*fooid=([0-9]++).*barid=([0-9]++)) shows that plain PCRE is the fastest one (I tried

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread David Waern
2009/2/5 Ross Paterson r...@soi.city.ac.uk: On Thu, Feb 05, 2009 at 03:03:35PM +0100, Wolfgang Jeltsch wrote: Am Donnerstag, 5. Februar 2009 13:16 schrieb Ross Paterson: On Thu, Feb 05, 2009 at 10:41:20AM +0100, Wolfgang Jeltsch wrote: type-level built fine with GHC 6.8 but failed to build

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Bulat Ziganshin
Hello Gregg, Thursday, February 5, 2009, 6:20:06 PM, you wrote: An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one getChar without changing the formal semantics.  this is prohibited by using pseudo-value of type RealWorld which

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Ketil Malde
Peter Verswyvelen bugf...@gmail.com writes: 1) hg st darcs cha -s lists just the filenames of changed, deleted, new files (with a char prefix to show what kind of change it is). 2) modify .hgignore to make sure only these files are added that are part of the project. I want this process

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Roman Cheplyaka
* Gregg Reynolds d...@mobileink.com [2009-02-05 09:20:06-0600] I think I've just about got monads figured out, but there's one detail that still escapes me. As I understand it, a monad is a kind of programming trick the uses data dependency to force evaluation order. x = f means apply f to

Re: [Haskell-cafe] Purely funcional LU decomposition

2009-02-05 Thread Rafael Gustavo da Cunha Pereira Pinto
2009/2/5 Henning Thielemann lemm...@henning-thielemann.de -- Forwarded message -- From: Henning Thielemann thunderb...@henning-thielemann.de To: Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com Date: Thu, 05 Feb 2009 14:43:13 +0100 Subject: Re:

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Peter Verswyvelen
On Thu, Feb 5, 2009 at 4:32 PM, Ketil Malde ke...@malde.org wrote: Peter Verswyvelen bugf...@gmail.com writes: 1) hg st darcs cha -s That seems to list all changes in the history. hg st lists local changes only. Can be done using darcs? ___

Re: [Haskell-cafe] Re: Purely funcional LU decomposition

2009-02-05 Thread Rafael Gustavo da Cunha Pereira Pinto
On Wed, Feb 4, 2009 at 05:15, Neal Alexander wqeqwe...@hotmail.com wrote: Array is no good man! Quad Tree matrices perform much nicer from what I've seen. I wrote some matrix stuff based on D. Stott Parker's Randomized Gaussian elimination papers

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 9:27 AM, Bulat Ziganshin bulat.zigans...@gmail.comwrote: Hello Gregg, Thursday, February 5, 2009, 6:20:06 PM, you wrote: An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one getChar without changing the

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Roman Cheplyaka
* Peter Verswyvelen bugf...@gmail.com [2009-02-05 16:35:34+0100] On Thu, Feb 5, 2009 at 4:32 PM, Ketil Malde ke...@malde.org wrote: Peter Verswyvelen bugf...@gmail.com writes: 1) hg st darcs cha -s That seems to list all changes in the history. hg st lists local changes

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: However, consider: getChar = \x - getChar An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one getChar without changing the formal semantics. Let's imagine that IO datatype is defined thus: {-#

[Haskell-cafe] Re: Fastest regex package?

2009-02-05 Thread Eugene Kirpichov
I was wrong about BoyerMoore: it works about 2x faster than PCRE for this example, so seems like it does the trick (although I suspect that one could do even faster, so the question remains). 2009/2/5 Eugene Kirpichov ekirpic...@gmail.com: Hello. What is the fastest regex package of the

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Lennart Augustsson
There's nothing magic about IO when it comes to monad semantics. If you take ghc's implementation of IO, it's a state monad. The new state generated by x is passed to f, so there's no way to skip x. (Well, if the compiler can show that the state is not used anywhere then it can start removing

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Gregg Reynolds
On Wed, Feb 4, 2009 at 8:18 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: That's a fairly common representation, seems to work for lots of people, but it caused me no end of trouble. Values are mathematical objects; how, I asked myself,

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 9:53 AM, Gleb Alexeyev gleb.alex...@gmail.comwrote: Let's imagine that IO datatype is defined thus: {-# LANGUAGE GADTs #-} {-# LANGUAGE NoImplicitPrelude #-} import Prelude(Monad, Char) data IO a where GetChar :: IO Char Bind :: IO a - (a - IO b) - IO b

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Jeremy Shaw
Hello, The type IO (in many Haskell implemenations) is essentially: type IO a = RealWorld - (a, RealWorld) And would be implemented like: () :: IO a - IO b - IO b action1 = action2 = \world0 - let (a, world1) = action1 world0 (b, world2) = action2 world1 in (b, world2) So,

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread mail
Gregg Reynolds d...@mobileink.com writes: I think I've just about got monads figured out, but there's one detail that still escapes me. As I understand it, a monad is a kind of programming trick the uses data dependency to force evaluation order. x = f means apply f to x; since the value of

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:00 AM, Lennart Augustsson lenn...@augustsson.net wrote: There's nothing magic about IO when it comes to monad semantics. If you take ghc's implementation of IO, it's a state monad. Doesn't that mean the semantics are defined by the implementation? My problem is that

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:26 AM, m...@justinbogner.com wrote: x = f does not mean apply f to x, it means do x, and then do f with the result of x. Bind is a sequencing operator rather than an application operator. Sequencing is a side effect of data dependency. What I should have said is x

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Bind is a sequencing operator rather than an application operator. In my opinion, this is a common misconception. I think that bind would be nicer if its arguments were reversed. -BEGIN PGP SIGNATURE- Version:

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: I must be misunderstanding something. I don't know if it would be optimized out, but I see no reason why it couldn't be. There's no data dependency, right? Of course there is data dependency. In my example, where IO is defined as a (generalized) algebraic datatype,

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread mail
Oops, sent this off list the first time, here it is again. Jake McArthur j...@pikewerks.com writes: m...@justinbogner.com wrote: | Bind is a sequencing operator rather than an application operator. In my opinion, this is a common misconception. I think that bind would be nicer if its

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 10:49 AM, Gleb Alexeyev gleb.alex...@gmail.com wrote: Gregg Reynolds wrote: I must be misunderstanding something. I don't know if it would be optimized out, but I see no reason why it couldn't be. There's no data dependency, right? Of course there is data

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Andrew Wagner
Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this. How is this different from optimizing out application of a constant function? No, no compiler

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gleb Alexeyev
Gregg Reynolds wrote: Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this. How is this different from optimizing out application of a constant function?

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 11:12 AM, Andrew Wagner wagner.and...@gmail.com wrote: Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this. How is this

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jeremy Shaw
At Thu, 5 Feb 2009 11:06:22 -0600, Gregg Reynolds wrote: Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this. How is this different from optimizing out

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gleb Alexeyev wrote: | Perhaps my example doesn't work, so I'll try another example. | As you know, (=) is just an (overloaded) higher-order function. | Let's consider another higher-order function, map. The expression | map (\x - 42) [1..3] |

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Oops, sent this off list the first time, here it is again. | | Jake McArthur j...@pikewerks.com writes: | m...@justinbogner.com wrote: | | Bind is a sequencing operator rather than an application operator. | | In my

[Haskell-cafe] RE: Define variable types

2009-02-05 Thread Tsunkiet Man
Hello, thank you guys for your responds. I got it working now =). Thanks a lot! Greetx JTKM ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Achim Schneider
Gregg Reynolds d...@mobileink.com wrote: getChar = \x - getChar An optimizer can see that the result of the first getChar is discarded It isn't discarded. The first getChar results in a value of type IO Char, always and ever. Whether or not the Char inside the IO Char gets evaluated or

[Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread mail
Jake McArthur j...@pikewerks.com writes: m...@justinbogner.com wrote: | Oops, sent this off list the first time, here it is again. | | Jake McArthur j...@pikewerks.com writes: | m...@justinbogner.com wrote: | | Bind is a sequencing operator rather than an application operator. | | In my

[Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread mail
Jake McArthur j...@pikewerks.com writes: m...@justinbogner.com wrote: | Oops, sent this off list the first time, here it is again. | | Jake McArthur j...@pikewerks.com writes: | m...@justinbogner.com wrote: | | Bind is a sequencing operator rather than an application operator. | | In my

Re: [Haskell-cafe] Re: build problems on Hackage

2009-02-05 Thread Wolfgang Jeltsch
Am Donnerstag, 5. Februar 2009 16:16 schrieb Ross Paterson: On Thu, Feb 05, 2009 at 03:03:35PM +0100, Wolfgang Jeltsch wrote: Anyway, can something be done so that not all packages depending (directly or indirectly) on type-level are without documentation? For example, type-level could be

[Haskell-cafe] Re: Fastest regex package?

2009-02-05 Thread ChrisK
Eugene Kirpichov wrote: All in all, my question remains: what is the fastest way to do this kind of parsing on a lazy bytestring? Your example regular expression works the same in both Posix and Perl-ish semantics. Do you know the difference? Posix libraries look for the longest match of

Re: [Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 11:47 -0700, m...@justinbogner.com wrote: Jake McArthur j...@pikewerks.com writes: m...@justinbogner.com wrote: | Oops, sent this off list the first time, here it is again. | | Jake McArthur j...@pikewerks.com writes: | m...@justinbogner.com wrote: | | Bind is a

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
2009/2/5 Gregg Reynolds d...@mobileink.com On Wed, Feb 4, 2009 at 8:18 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: That's a fairly common representation, seems to work for lots of people, but it caused me no end of trouble. Values are

[Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread ChrisK
Gregg Reynolds wrote: getChar = \x - getChar An optimizer can see that the result of the first getChar is discarded True, so 'x' is not used, and it can be garbage collected, and may not even be created. But that data dependency is simple not the data dependency that make IO

Re: [Haskell-cafe] Bind as a sequencing operator (Was: evaluation semantics of bind)

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | [1..2] = return . (^2) | | This says generate the list [1..2] and then use it to generate a list | of squares. It's more than just application, it's a description of a | sequence of actions. The whole point of list

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Andrew Wagner
I think the point of the Monad is that it works as a container of stuff, that still allows mathematically pure things to happen, while possibly having some opaque other stuff going on. This at least sounds, very wrong, even if it's not. Monads are not impure. IO is, but it's only _one_

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Miguel Mitrofanov
Let's put it this way: suppose you have two data types, say, Int and String; a value s of type String and a function f :: String - (Int - String) - String This could be anything - may be, a function which looks for the first character '#' in it's first argument and replaces it with the

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Miguel Mitrofanov
Ahem... WHAT??? IO monad is impure??? What do you mean? On 5 Feb 2009, at 22:25, Andrew Wagner wrote: I think the point of the Monad is that it works as a container of stuff, that still allows mathematically pure things to happen, while possibly having some opaque other stuff going on.

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Lennart Augustsson
You are absolutely right. The statement The values of the IO monad are programs that do IO. is somewhat nonsensical. Values don't do anything, they just are. But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 11:22 AM, Gleb Alexeyev gleb.alex...@gmail.com wrote: Gregg Reynolds wrote: Are you saying that using equations to add a level of indirection prevents optimization? I still don't see it - discarding x doesn't change the semantics, so a good compiler /should/ do this.

[Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread mail
Jake McArthur j...@pikewerks.com writes: The problem with your description is that you said and then. The result will be generated lazily. There is no sequencing here. Consider: ~do x - [0..] ~ y - [0..9] ~ return (x, y) Which list is generated first? This is an

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Gregg Reynolds
On Thu, Feb 5, 2009 at 1:46 PM, Lennart Augustsson lenn...@augustsson.net wrote: You are absolutely right. The statement The values of the IO monad are programs that do IO. is somewhat nonsensical. Values don't do anything, they just are. Whew! So I'm not crazy. I was starting to wonder.

[Haskell-cafe] Success (was: cURL under Windows again)

2009-02-05 Thread Iliya Kuznetsov
The problem has solved. Solution, given by http://awson.livejournal.com/, is: 1. Copy libcurl-4.dll to libcurl.dll beause of namescheme 2. Before building haskell curl-1.3.4 _under windows_ you have to change #define CURL_EXTERN __declspec(dllimport) to #define CURL_EXTERN. After that,

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 20:46 +0100, Lennart Augustsson wrote: You are absolutely right. The statement The values of the IO monad are programs that do IO. is somewhat nonsensical. Values don't do anything, they just are. Technically, programs don't do anything either. I think of values of

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner wagner.and...@gmail.comwrote: I think the point of the Monad is that it works as a container of stuff, that still allows mathematically pure things to happen, while possibly having some opaque other stuff going on. This at least sounds, very

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Tim Newsham
You are absolutely right. The statement The values of the IO monad are programs that do IO. is somewhat nonsensical. Values don't do anything, they just are. But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Andrew Wagner
On Thu, Feb 5, 2009 at 3:21 PM, David Leimbach leim...@gmail.com wrote: Well all I can tell you is that I can have (IO Int) in a function as a return, and the function is not idempotent in terms of the stuff inside IO being the same. Sounds impure to me. Right, thus IO is impure. but as

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 12:25 PM, Andrew Wagner wagner.and...@gmail.comwrote: On Thu, Feb 5, 2009 at 3:21 PM, David Leimbach leim...@gmail.com wrote: Well all I can tell you is that I can have (IO Int) in a function as a return, and the function is not idempotent in terms of the stuff inside

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner wagner.and...@gmail.com wrote: I think the point of the Monad is that it works as a container of stuff, that still

Re: [Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 m...@justinbogner.com wrote: | Jake McArthur j...@pikewerks.com writes: | The problem with your description is that you said and then. The | result will be generated lazily. There is no sequencing here. Consider: | | ~do x - [0..] | ~ y -

Re: [Haskell-cafe] Re: Bind as a sequencing operator

2009-02-05 Thread Andrew Wagner
bind is no more a sequencing operator than function composition is. Just as the order in which you pass two functions (ignoring the type issue for the moment) matters, the order in which you pass things to bind matters. The sense in which the order _doesn't_ matter is that of the order in which

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread David Leimbach
On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast jonathancc...@fastmail.fmwrote: On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner wagner.and...@gmail.com wrote: I think the point of the Monad is that it

[Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Andrew Wagner
So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about haskell programs like we would like to. My question is, to what

[Haskell-cafe] Re: OpenAL

2009-02-05 Thread Paul Langevin
Does the example code at http://articles.bluishcoder.co.nz/Haskell/OpenAL work for anyone? sorry for the delay, Brian : I can hear the two sounds one after the other (I wish I knew how to hear them at the same time). However, I've got a strange error message from ALSA : alsa_blitbuffer:

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 16:11 -0500, Andrew Wagner wrote: So we all know the age-old rule of thumb, that unsafeXXX is simply evil and anybody that uses it should be shot (except when it's ok). I understand that unsafeXXX allows impurity, which defiles our ability to reason logically about

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andrew Wagner wrote: | I understand that unsafeXXX allows impurity, which defiles our ability | to reason logically about haskell programs like we would like to. My | question is, to what extent is this true? My opinion is that unsafeXXX is

Re: [Haskell-cafe] about integer and float operations

2009-02-05 Thread Henning Thielemann
Yitzchak Gale schrieb: Manlio Perillo wrote: However there is still a *big* problem: it is inefficient. Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: http://paste.pocoo.org/show/102800/ On my system it takes 10 seconds. Here is an Haskell version:

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
I do have asked myself the question whether a really random generating function could be regarded as pure somehow (actually would a true random function still be a mathematical function?) E.g. the function would return a true (not pseudo) random number, practically unpredictable (e.g. hardware

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Max Rabkin
2009/2/5 Peter Verswyvelen bugf...@gmail.com: Of course you could just put this random generator in the IO monad, but certain algorithms- like Monte Carlo - intuitively don't seem to operate in a IO monad to me. For PRNGs, only State is needed, not IO. But you might find the `randoms'

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread Henning Thielemann
Peter Verswyvelen schrieb: 3) hg addrem this adds new files and removes deleted files from local repos. forgetting to add files is a common problem, and is really tricky since no record is made of these files, so if after a couple of versions if a developer finds out a file was missing, the

[Haskell-cafe] Signatures in defining functions

2009-02-05 Thread TKM
Hello, I'm kind of new with Haskell and I would like to know about the following: [some function]:: Int - Int - Int Now is my question, how should I interpret Int - Int - Int? Meaning what does Int - Int - Int mean? Thank you for answering my question. Kind Regards,

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Jake McArthur
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Verswyvelen wrote: | I do have asked myself the question whether a really random generating | function could be regarded as pure somehow (actually would a true | random function still be a mathematical function?) | | E.g. the function would

[Haskell-cafe] Error in building profiling

2009-02-05 Thread Marco Túlio Gontijo e Silva
Hello, I'm trying to package ghc-paths for debian, and I got to this: $ ./setup configure --enable-library-profiling --disable-library-vanilla Configuring ghc-paths-0.1.0.5... $ ./setup build Preprocessing library ghc-paths-0.1.0.5... Building ghc-paths-0.1.0.5... /usr/bin/ar: creating

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Jonathan Cast
On Thu, 2009-02-05 at 13:01 -0800, David Leimbach wrote: On Thu, Feb 5, 2009 at 12:27 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-02-05 at 12:21 -0800, David Leimbach wrote: On Thu, Feb 5, 2009 at 11:25 AM, Andrew Wagner

Re: [Haskell-cafe] Just how unsafe is unsafe

2009-02-05 Thread Peter Verswyvelen
Well, one could say that a truly random number function takes as input time and some constant unique identifier (serial number) of the TRND device and gives you the random value measured at that time by this device. Of course this would mean the random value is not really random, since the

Re: [Haskell-cafe] Signatures in defining functions

2009-02-05 Thread Martijn van Steenbergen
Hi JTKM, TKM wrote: Now is my question, how should I interpret Int - Int - Int? Meaning what does Int - Int - Int mean? There are many good tutorials and books online. Here's a link that directly answers your question: http://book.realworldhaskell.org/read/types-and-functions.html#id581829

  1   2   >