Re: [Haskell-cafe] Optimizing 'sequence'

2008-07-22 Thread Janis Voigtlaender
Don Stewart wrote: If you can demonstrate the required laziness/strictness properties are identical, looks like a nice idea. I think they are not identical, as something along Antoine's second example demonstrates. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/

[Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Gracjan Polak
Antoine Latter aslatter at gmail.com writes: The function runIdentity is found in Control.Monad.Identity in the mtl package. Thanks, I see it now! Laziness is not there! But still... Identity is a bit special monad. What other monads need full laziness in sequence? As far as I know IO is

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Janis Voigtlaender
Gracjan Polak wrote: Initially I spotted this possible optimization in context of monadic parser. I am not really sure if I need this property there or not. How do I prove this to myself? How about some QuickChecking in connection with the Chasing bottoms library

Re: [Haskell-cafe] Building NDP with latest GHC

2008-07-22 Thread Manuel M T Chakravarty
Austin Seipp: After my last issue with GHC's HEAD, I tried checking it out again and getting the patches for the libraries and lo and behold, it worked. So now I'm up to date with the latest libraries and the compiler, but it appears that building NDP itself is proving to be troublesome. The

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Luke Palmer
On Tue, Jul 22, 2008 at 1:15 AM, Gracjan Polak [EMAIL PROTECTED] wrote: Antoine Latter aslatter at gmail.com writes: The function runIdentity is found in Control.Monad.Identity in the mtl package. But still... Identity is a bit special monad. What other monads need full laziness in

[Haskell-cafe] Re: Haskell on ARM (was Re: ANN: Topkata)

2008-07-22 Thread Simon Marlow
Braden Shepherdson wrote: So, assuming some GHC dev doesn't swoop down and fix this, what options are left to the project in the short term? An unregisterised build of an old 6.6 should work, that would get us a working, though aging, GHC. Unfortunately a lot of the porting work to move

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Chaddaï Fouché
2008/7/22 Luke Palmer [EMAIL PROTECTED]: A little formal reasoning reveals that sequence1 = sequence2 exactly when (=) is strict in its left argument. There are four common monads which are _not_: Identity, Reader, Writer, State (and RWS by extension). Still if that makes that much of a

[Haskell-cafe] Re: Haskell on ARM (was Re: ANN: Topkata)

2008-07-22 Thread Joe Buehler
Simon Marlow wrote: For the registerised port, you really need a native code generator (the mangler is on death row, yay). At a rough guess, I'd say porting the NCG would take a couple of weeks or so for someone unfamiliar with the code. Hopefully we'll improve that when we refactor the NCG

[Haskell-cafe] array fusion interface

2008-07-22 Thread Evan Laforge
With all the noise lately about high performance array libraries with list-like interfaces, such as bytestring, storablevector, uvector, and vector, I thought I would try to make use of one in a project of mine, and I'm either bumping up against the limits of its expressiveness, or am missing out

[Haskell-cafe] Newbie: Replacing substring?

2008-07-22 Thread Dmitri O.Kondratiev
A few simple questions: What standard library function can be used to replace substring in a string (or sub-list in a list) ? I wrote my own version, please criticize: -- replace all occurances of 123 with 58 in a string: test = replStr abc123def123gh123ikl 123 58 {-- In a string replace all

Re: [Haskell-cafe] Portland OSCon

2008-07-22 Thread Justin Bailey
The PDX functional programming interest group will have a dinner meeting at the location below tonight. John Goerzen had asked if there would be a Haskell get together in Portland during OSCON. Here is one opportunity! -- Forwarded message -- From: Igal Koshevoy [EMAIL PROTECTED]

Re: [Haskell-cafe] Newbie: Replacing substring?

2008-07-22 Thread Roberto Zunino
Dmitri O.Kondratiev wrote: I wrote my own version, please criticize: -- replace all occurances of 123 with 58 in a string: test = replStr abc123def123gh123ikl 123 58 This is a tricky problem: first of all, you fail your own test! ;-) *Main test abc58def58gh58ikl58 (Note the extra 58 at the

Re: [Haskell-cafe] Newbie: Replacing substring?

2008-07-22 Thread Dmitri O.Kondratiev
Roberto thanks! Shame on me, to post code without enough testing :( Yet, thanks to your comments *I think* I have found the bugs you wrote about and now my code works, please see corrected version below. Extra substring at the end was a result of using foldr with initial element of []. I fixed

[Haskell-cafe] Point-free style in guards

2008-07-22 Thread L29Ah
outStanza | (isMessage) = outMessage | (isPresence) = outPresence | (isIQ) = outIQ Why such a style doesn't work, so I must write ugly code like that: outStanza a | (isMessage a) = outMessage a | (isPresence a) = outPresence a | (isIQ a) = outIQ a

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Neil Mitchell
Hi Why such a style doesn't work, so I must write ugly code like that: outStanza a | (isMessage a) = outMessage a | (isPresence a) = outPresence a | (isIQ a) = outIQ a You can make it slightly prettier, since the brackets are not necessary: outStanza a | isMessage

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Brandon S. Allbery KF8NH
On Jul 22, 2008, at 13:18 , L29Ah wrote: outStanza | (isMessage) = outMessage | (isPresence) = outPresence | (isIQ) = outIQ Why such a style doesn't work, so I must write ugly code like that: Because the Haskell 98 Report specifies that guards are rewritten in a

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Evan Laforge
On Tue, Jul 22, 2008 at 10:27 AM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Why such a style doesn't work, so I must write ugly code like that: outStanza a | (isMessage a) = outMessage a | (isPresence a) = outPresence a | (isIQ a) = outIQ a You can make it

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Claus Reinke
outStanza | (isMessage) = outMessage | (isPresence) = outPresence | (isIQ) = outIQ Why such a style doesn't work, so I must write ugly code like that: outStanza a | (isMessage a) = outMessage a | (isPresence a) = outPresence a | (isIQ a) = outIQ a

[Haskell-cafe] BLAS Solve Example

2008-07-22 Thread Darrin Thompson
I'm stuck on something that I thought would be easy. I have a matrix and a vector. module Main where import Data.Vector.Dense import Data.Matrix.Dense import BLAS.Matrix.Solve m = listMatrix (2, 3) ([1, 2, 3, 4, 5, 6]::[Double]) v = listVector 2 ([1, 2]::[Double]) main = do ??? Can I

Re: [Haskell-cafe] Newbie: Replacing substring?

2008-07-22 Thread Ronald Guida
2008/7/22 Dmitri O.Kondratiev [EMAIL PROTECTED]: On the side: The more I use Haskell - the more I like it ! It helps me think about the problem I solve much more clearly then when I use imperative language. If I want to replace a substring in a string, then I would search my string left to

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread J.N. Oliveira
On Jul 22, 2008, at 6:32 PM, Brandon S. Allbery KF8NH wrote: On Jul 22, 2008, at 13:18 , L29Ah wrote: outStanza | (isMessage) = outMessage | (isPresence) = outPresence | (isIQ) = outIQ Why such a style doesn't work, so I must write ugly code like that: Because the

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Luke Palmer
2008/7/22 J.N. Oliveira [EMAIL PROTECTED]: But you still need the extra parentheses... Not so! infixl 0 .| infixl 0 .|... -- 'otherwise' construct infix 1 .= (.=) :: (a - Bool) - (a - b) - (a - Maybe b) (.|) :: (a - Maybe b) - (a - Maybe b) - (a - Maybe b) (.|...) :: (a - Maybe b) - (a - b) -

Re: [Haskell-cafe] BLAS Solve Example

2008-07-22 Thread Patrick Perry
Sorry Darrin, the BLAS library only includes matrix multiplication and solving triangular systems. To solve a general system, you would need to use LAPACK, but there aren't any bindings for that library yet. I would suggest you take a look at the hmatrix package, which includes a lot

[Haskell-cafe] ANN: list-extras 0.1.0

2008-07-22 Thread wren ng thornton
hello all~ I'm pleased to announce the initial version of list-extras, a home for common not-so-common list functions. There are many simple but non-trivial functions for lists which Data.List lacks. Typically we write a version and include it in a larger project or store it in a local

Re: [Haskell-cafe] Linux kernel/library question

2008-07-22 Thread Galchin, Vasili
Thank you, Fero and Sylvain! Vasili On Mon, Jul 21, 2008 at 2:21 PM, sylvain nahas [EMAIL PROTECTED] wrote: Hi Vasili, Please have a look at http://vger.kernel.org/vger-lists.html The main list is linux-kernel. Depending on the level of your questions, you may also check

Re: [Haskell-cafe] ANN: list-extras 0.1.0

2008-07-22 Thread Bulat Ziganshin
Hello wren, Wednesday, July 23, 2008, 6:46:01 AM, you wrote: I'm pleased to announce the initial version of list-extras, a home for common not-so-common list functions. MissingH library contained a lot of them too. i know that John Goerzen started to break it into area-specific libs, so may