[Haskell-cafe] Re: Yi pre-release

2007-04-09 Thread Jean-Philippe Bernardy
Dominic Steinitz dominic.steinitz at blueyonder.co.uk writes: setup: Unrecognised flags: --disable-haddock-use-packages make[1]: *** [.setup-config] Error 1 make[1]: Leaving directory `/home/dom/yi/yi/packages/yi-vty' You can either upgrade to the latest Cabal repo, or pull the latest

Fwd: [Haskell-cafe] Yi pre-release

2007-04-09 Thread Dominic Steinitz
[EMAIL PROTECTED]:~/yi/yi make ghc --make Setup.*hs -o setup [1 of 1] Compiling Main ( Setup.hs, Setup.o ) Linking setup ... ./setup configure --user --with-haddock=/home/dom/usr//bin/haddock --prefix=/home/dom/usr/ --datadir=--prefix=/home/dom/usr/

[Haskell-cafe] Re: Fwd: Yi pre-release

2007-04-09 Thread Jean-Philippe Bernardy
Dominic Steinitz dominic.steinitz at blueyonder.co.uk writes: setup: ../../Yi/Syntax/Haskell.x: no alex preprocessor available You need Alex. http://www.haskell.org/alex/ JP, I assume this is the sort of feedback you want? Yes, it allows me to update the installation

[Haskell-cafe] Re: Fwd: Yi pre-release

2007-04-09 Thread Jean-Philippe Bernardy
Dominic Steinitz dominic.steinitz at blueyonder.co.uk writes: So make finds alex but make emacs doesn't. Try to do make clean at the toplevel to re-do a cabal configure. Cheers, JP. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Fwd: Yi pre-release

2007-04-09 Thread Dominic Steinitz
JP, I deleted the lot and re-installed. make emacs then worked. Three things. 1. ~/usr/bin isn't on my path. Clearly I can fix. 2. Where should YiConfig.hs live? I know it's in examples but I don't want to copy it into every directory. [EMAIL PROTECTED]:~ ~/usr/bin/yi test.hs command

[Haskell-cafe] Re: Fwd: Yi pre-release

2007-04-09 Thread Jean-Philippe Bernardy
Dominic Steinitz dominic.steinitz at blueyonder.co.uk writes: 1. ~/usr/bin isn't on my path. Clearly I can fix. You can install the cabal packages for everyone (ie. dropping --user) 2. Where should YiConfig.hs live? I know it's in examples but I don't want to copy it into every directory.

Re: [Haskell-cafe] Yi pre-release

2007-04-09 Thread Duncan Coutts
On Sun, 2007-04-08 at 18:20 +0100, Dominic Steinitz wrote: setup: Unrecognised flags: --disable-haddock-use-packages make[1]: *** [.setup-config] Error 1 make[1]: Leaving directory `/home/dom/yi/yi/packages/yi-vty' That's using a feature from the development version of cabal. I just hacked

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread David House
On 09/04/07, Albert Lee [EMAIL PROTECTED] wrote: mapM putStrLn files Seeing as you're not doing anything with the results of this map, you probably want to use mapM_ instead. Then the result type of ls_dir1 can be IO (), which is neater. -- -David House, [EMAIL PROTECTED]

[Haskell-cafe] runInteractiveCommand

2007-04-09 Thread Sergey Perminov
I wished to get output of unix commands in haskell code. So i wrote: -- import System.IO import System.Process eval :: String - IO String eval s = do (_,hOutput,_,hProcess) - runInteractiveCommand s

[Haskell-cafe] Grabbing list of functions from current module

2007-04-09 Thread Joel Reymont
Folks, Does anyone have code that can grab a list of functions named with a certain prefix from the current (or given) module? I want to find functions named, say, ast_* and produce a list of tuples like (input1, ast_input1). Thanks, Joel -- http://wagerlabs.com/

Re: [Haskell-cafe] runInteractiveCommand

2007-04-09 Thread Dave Feustel
I tried the code below with both ghc 6.2.2 and hugs march 2005. ghc: The last statement in a 'do' construct must be an expression Hugs ERROR interactive.hs - Can't find imported module System.Process . -- import

Re: [Haskell-cafe] Grabbing list of functions from current module

2007-04-09 Thread John Meacham
On Mon, Apr 09, 2007 at 01:39:55PM +0100, Joel Reymont wrote: Folks, Does anyone have code that can grab a list of functions named with a certain prefix from the current (or given) module? I want to find functions named, say, ast_* and produce a list of tuples like (input1,

Re: [Haskell-cafe] Grabbing list of functions from current module

2007-04-09 Thread Joel Reymont
Mea culpa! I meant Template Haskell code :-). Thanks John! On Apr 9, 2007, at 2:02 PM, John Meacham wrote: sed -ne 's/^ast_\([a-z0-9_A-Z]\+\).*$/(\1,ast_\1)/p' File.hs note the two occurances of 'ast_'. -- http://wagerlabs.com/ ___

Re: [Haskell-cafe] runInteractiveCommand

2007-04-09 Thread Brandon S. Allbery KF8NH
On Apr 9, 2007, at 8:57 , Dave Feustel wrote: I tried the code below with both ghc 6.2.2 and hugs march 2005. ghc: The last statement in a 'do' construct must be an expression The indentation got mangled. Reindent the lines of the do so they line up: eval s = do (_,hOutput,_,hProcess)

Re: [Haskell-cafe] Re: `Expect'-like lazy reading/Parsec matching on TCP sockets

2007-04-09 Thread Scott Bell
Have you got a complete (but preferably small) program showing the problem? Ian, Here is the source and behavior that I'm seeing (Linux x86, under both 6.6 and 6.7-20070404: module Main where import System.IO import System.IO.Unsafe import System.Process import Text.ParserCombinators.Parsec

[Haskell-cafe] Profiling makes memory leak go away? Is Haskell a practical language?

2007-04-09 Thread Oren Ben-Kiki
Chasing down my memory leak I got into a weird situation where adding a magic manual SCC section and compiling with -prof makes the leak disappear. Now, I'll take any solution I can find - but this black voodoo only works for the short program I created for investigating the leak. It fails on the

[Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Jefferson Heard
I have a series of NxM numeric tables I'm doing a quick mean/variance/t-test etcetera on. The cell t1 [i,j] corresponds exactly to the cells t2..N [i,j], and so it's perfectly possible to read one item at a time from each of the 100 files and compute the mean/variance etcetera on all cells that

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Bulat Ziganshin
Hello Jefferson, Monday, April 9, 2007, 9:34:12 PM, you wrote: if you have enough memory available, the fastest way is to read file to memory using bytestring, convert it into array of doubles, repeating this step for all files. then perform your computations. if you will try to read 100 files

Re: [Haskell-cafe] runInteractiveCommand

2007-04-09 Thread Udo Stenzel
Sergey Perminov wrote: I wished to get output of unix commands in haskell code. So i wrote: -- import System.IO import System.Process eval :: String - IO String eval s = do (_,hOutput,_,hProcess) -

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread Bulat Ziganshin
Hello Albert, Monday, April 9, 2007, 6:46:14 AM, you wrote: It can print the first entry of the dir, but how can we list it all like the C prog?  map ? list comperhension? http://haskell.org/haskellwiki/IO_inside forever :) -- Best regards, Bulatmailto:[EMAIL

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Jefferson Heard
Thanks for the advice. I'm not so much interested in performance here, as this is just a one-off. Disk thrashing or not, these files are only a few hundred K apiece, and I can't imagine that the whole computation will take more than a few minutes. My question is more about how to deal with

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread David Brown
Albert Lee wrote: and I write that in haskell: - import System.Posix import System.IO main = do dp - openDirStream / df - readDirStream dp putStrLn df closeDirStream dp Some code snippets out of harchive, which uses DirStream: bracket (openDirStream path)

[Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Joel Reymont
Folks, I'm trying to parse NumExpr NumExpr (example) which should return a logical expression while parsing numeric terms. I can't figure out how to make buildExpressionParser do this for me since it takes the type of the term parser given to it. If I supply a parser for numeric terms

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread Brandon Michael Moore
It looks like all you can do with DirStream is get the filename, not look at any other fields of the dirent - actually, it seems name is the only standard field. You might as well use getDirectoryContents, unless you have a directory so huge that a list of all the filenames takes too much memory!

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread Jeremy Shaw
Hello, This multipart tutorial seems similar to what you are describing: http://blog.moertel.com/articles/2007/03/28/directory-tree-printing-in-haskell-part-three-lazy-i-o The tutorial is actually a bit more complicated, it is traversing a whole directory tree and printing a nice graph. HTH,

Re: [Haskell-cafe] Re: [web-devel] A light-weight web framework

2007-04-09 Thread S. Alexander Jacobson
That is why I prefer JSON and XSLT as template languages. The client side developer can't use them to do business logic and they are both idiomatically closer to the world in which the client side developer lives. Once we get the auto-conversion to XML/JSON working in HAppS, life gets

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Duncan Coutts
On Mon, 2007-04-09 at 14:40 -0400, Jefferson Heard wrote: Thanks for the advice. I'm not so much interested in performance here, as this is just a one-off. Disk thrashing or not, these files are only a few hundred K apiece, and I can't imagine that the whole computation will take more than a

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Albert Y. C. Lai
Joel Reymont wrote: I'm trying to parse NumExpr NumExpr (example) which should return a logical expression while parsing numeric terms. I can't figure out how to make buildExpressionParser do this for me since it takes the type of the term parser given to it. If I supply a parser for numeric

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Joel Reymont
Albert, On Apr 10, 2007, at 12:19 AM, Albert Y. C. Lai wrote: As you probably suspect, one single use of buildExpressionParser cannot accomplish it. It is equivalent to the problem of homogeneous lists. The issue is that I need buildExpressionParser to parse numerical expression but

[Haskell-cafe] Parsec: Help needed with simple parser

2007-04-09 Thread Joel Reymont
Folks, I wrote a parser for what should be a simple expression but it's not working. Any help is appreciated! My expression is x + 1 where x can be either Close, or Close[N] or Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Jefferson Heard
It is indeed! Is that to be found in Control.Monad, I take it? On Tue, 2007-04-10 at 08:50 +1000, Duncan Coutts wrote: On Mon, 2007-04-09 at 14:40 -0400, Jefferson Heard wrote: Thanks for the advice. I'm not so much interested in performance here, as this is just a one-off. Disk thrashing

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Stefan O'Rear
On Mon, Apr 09, 2007 at 09:24:30PM -0400, Jefferson Heard wrote: It is indeed! Is that to be found in Control.Monad, I take it? It's in the Prelude, so you don't have to import anything to get it. Stefan ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Albert Y. C. Lai
Albert Y. C. Lai wrote: However, you can make two uses of buildExpressionParser, one for numeric expressions and the other for logical expressions. Mutual reference is no problem since, OK, I now see this is easier said than done in most common applications.

Re: [Haskell-cafe] Parsec: Help needed with simple parser

2007-04-09 Thread Albert Y. C. Lai
Joel Reymont wrote: My expression is x + 1 where x can be either Close, or Close[N] or Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x + 1 doesn't. In fact, I would be fine with parsing Close + such that it ignores the plus and

Re: [Haskell-cafe] operating on a hundred files at once

2007-04-09 Thread Duncan Coutts
On Mon, 2007-04-09 at 21:24 -0400, Jefferson Heard wrote: It is indeed! Is that to be found in Control.Monad, I take it? Yes. Other common derivatives in that module include: mapM f as = sequence (map f as) mapM_ f as = sequence_ (map f as) forM_ = flip mapM_ forM = flip mapM however,