Re: [Haskell-cafe] Parsec on TeX

2008-05-05 Thread Ross Boylan
On Sun, 2008-05-04 at 23:59 -0500, Derek Elkins wrote: Unfortunately, Daan seems to have disappeared off of the face of the internet so there isn't anything that can be done about fixing that documentation (and likely that is in large part why this error is still there.)

Re: [Haskell-cafe] Ann: Win32-notify 0.1

2008-05-05 Thread Bit Connor
Factor has a file system notification API that wraps windows, linux and mac ones. It might be worth taking a look at that to see what it does. Mono also has such an API and I've heard very good things about it. It would also be worth looking at. ___

Re: [Haskell-cafe] Haskell PNG Writer

2008-05-05 Thread Bjorn Bringert
The libgd bindings can be used to create PNG images. See http://hackage.haskell.org/cgi-bin/hackage-scripts/package/gd /Björn On Mon, May 5, 2008 at 9:05 AM, Bit Connor [EMAIL PROTECTED] wrote: It would be nice to have haskell bindings to the libpng C library. I had trouble calling libpng

[Haskell-cafe] A common pattern

2008-05-05 Thread Andrew Coppin
I've found myself writing code like this several times now. Is there a better way? read_args h = do line - hGetLine h case line of . - return [] ('#':y) - do ys - read_args h return (y:ys) ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] A common pattern

2008-05-05 Thread Neil Mitchell
Hi I've found myself writing code like this several times now. Is there a better way? hGetContents might be a different way to write a similar thing: read_args h = do src - hGetContents h let (has,rest) = span (# `isPrefixOf`) $ lines src return (map tail has) Of course,

Re: [Haskell-cafe] Parsec on TeX

2008-05-05 Thread Andrew Coppin
Ross Boylan wrote: First, I'm really impressed with the fast and helpful responses from several people! Ask an easy question and you'll get at least a dozen people tripping over each other in their rush to offer you useful advice. Ask a hard question, or an uninteresting question, and

Re: [Haskell-cafe] A common pattern

2008-05-05 Thread Andrew Coppin
Neil Mitchell wrote: Hi I've found myself writing code like this several times now. Is there a better way? hGetContents might be a different way to write a similar thing: read_args h = do src - hGetContents h let (has,rest) = span (# `isPrefixOf`) $ lines src return

Re: [Haskell-cafe] ANN: ReviewBoard 0.1 bindings

2008-05-05 Thread Johan Tibell
On Thu, May 1, 2008 at 8:28 AM, Adam Smyczek [EMAIL PROTECTED] wrote: This package is part of a development tool designed to monitor code changes, analyze dependencies etc. Actually, we are still in process to develop the tool and this binding is the first functional ready package others

Re: [Haskell-cafe] A common pattern

2008-05-05 Thread Abhay Parvate
Hi Andrew, I don't know whether it's intentional, but the patterns for case line of are not exaustive. Are you sure you do not expect anything else apart from a single . or a line starting with '#'? More below: On Mon, May 5, 2008 at 1:45 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Neil

[Haskell-cafe] Re: Parsec on TeX

2008-05-05 Thread apfelmus
Don Stewart wrote: Yeah, if you're on Debian it would make sense to install GHC -- its much more active, much faster, and supports more things. [than Hugs] Except for compile and load time, Hugs is really fast there. Regards, apfelmus ___

Re: [Haskell-cafe] A common pattern

2008-05-05 Thread Andrew Coppin
Abhay Parvate wrote: Hi Andrew, I don't know whether it's intentional, but the patterns for case line of are not exaustive. Are you sure you do not expect anything else apart from a single . or a line starting with '#'? It's reading a wire protocol, so if you hit anything else there's been

Re: [Haskell-cafe] Re: Parsec on TeX

2008-05-05 Thread Andrew Coppin
apfelmus wrote: Don Stewart wrote: Yeah, if you're on Debian it would make sense to install GHC -- its much more active, much faster, and supports more things. [than Hugs] Except for compile and load time, Hugs is really fast there. Mmm, possibly. I seem to recall it being instantaneous on

[Haskell-cafe] Grokking monads by not overlooking concatMap

2008-05-05 Thread Achim Schneider
guard True = return () guard False = [] -- the textbook example f = do x - [1..4] y - [2..8] guard (x*y==8) return (x,y) -- the translation. f' = [1..4] = (\x - [2..8] = (\y - (if (x*y == 8) then return () else []) return (x,y))) -- another one. note that we can

[Haskell-cafe] Re: A common pattern

2008-05-05 Thread Achim Schneider
Andrew Coppin [EMAIL PROTECTED] wrote: Do I get an exception or just the end of the string?) I might possibly be able to just use hGetContents and run a parser lazily over the result, we'll see. You get an exception. I used this scheme for a toy http server using lazy Bytestrings, and it

[Haskell-cafe] Data structure to manage collection of sets with efficient lookup, intersection?

2008-05-05 Thread Patrick Surry
New to Haskell, with a mental block about how to represent this situation efficiently: I have an unknown function f which is defined on subsets of some universal set (say integers 1...N). I know the values of f for some subsets, and using those can infer values on other subsets. So what

Re: [Haskell-cafe] Parsec on TeX

2008-05-05 Thread Derek Elkins
On Sun, 2008-05-04 at 23:57 -0700, Ross Boylan wrote: On Sun, 2008-05-04 at 23:59 -0500, Derek Elkins wrote: Unfortunately, Daan seems to have disappeared off of the face of the internet so there isn't anything that can be done about fixing that documentation (and likely that is in large

[Haskell-cafe] Re: Data structure to manage collection of sets with efficient lookup, intersection?

2008-05-05 Thread Achim Schneider
Patrick Surry [EMAIL PROTECTED] wrote: New to Haskell, with a mental block about how to represent this situation efficiently: I have an unknown function f which is defined on subsets of some universal set (say integers 1...N). I know the values of f for some subsets, and using those

[Haskell-cafe] A Cabal problem

2008-05-05 Thread Mario Blazevic
I have a problem with Cabal: it doesn't seem to pick up the Main-is: option from the configuration file. Here's my scc.cabal file. Note the Main-is: line: Name:scc Version: 0.1 Cabal-Version: = 1.2 Build-Type: Simple License: GPL

Re: [Haskell-cafe] Using Template Haskell to make type-safe database access

2008-05-05 Thread Wouter Swierstra
Hi Mads, I was wondering if anybody had experimented with using Template Haskell (TH) and ordinary SQL to make type-safe database access? I know HaskellDB, for example, does something quite similar. There's a preprocessor that generates a Haskell file with a Haskell representation of

Re: [Haskell-cafe] Re: Couple of formal questions

2008-05-05 Thread Wouter Swierstra
On 1 May 2008, at 16:58, Michael Karcher wrote: Wouter Swierstra [EMAIL PROTECTED] wrote: Hi Creighton, Where could I find a proof that the initial algebras final coalgebras of CPO coincide? I saw this referenced in the Bananas.. paper as a fact, but am not sure where this comes from. I

[Haskell-cafe] Non-Overlapping Patterns

2008-05-05 Thread PR Stanley
Hi isZero :: Int - Bool isZero 0 = True isZero n | n /= 0 = False The order in which the above equations appear makes no difference to the application of isZero. Does the Haskell interpreter rewrite patterns into one single definition using some sort of switch or if construct? Why does an

Re: [Haskell-cafe] Non-Overlapping Patterns

2008-05-05 Thread Andrew Coppin
PR Stanley wrote: To put it another way, why doesn't the interpreter identify the more specific cases and put them before the general ones. I'm guessing because determining which equation is the most general is equivilent to the Halting Problem in the general case. (Notice that Mathematica

[Haskell-cafe] Re: Non-Overlapping Patterns

2008-05-05 Thread Michael Karcher
PR Stanley [EMAIL PROTECTED] wrote: after the more specific cases?To put it another way, why doesn't the interpreter identify the more specific cases and put them before the general ones. Given the function foo below, which of the first lines is more specific? No reordering means, that it is

[Haskell-cafe] Re: Non-Overlapping Patterns

2008-05-05 Thread Achim Schneider
Achim Schneider [EMAIL PROTECTED] wrote: isZero n = case n of 0 - True n - if n /= 0 then False else undefined You can't exchange the order, here, of course, the semantics of this and a guard-version would differ. -- (c) this sig last receiving

[Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Sai Hemanth K
Hi, I declared a multi param type class as below: *class MyString m c where zIndex :: m - Int - c zLength :: m - Int zPack :: [c] - m zEquals :: c -c - Bool zWrap :: [c] - (m,AnExistingDataType)* In the end I did not needed it for my program, but for those few

Re: [Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Bulat Ziganshin
Hello Sai, Monday, May 5, 2008, 7:52:29 PM, you wrote: class MyString m c  where it should be class MyString m c | m-c where so ghc will realize that same m means the same c. read about functional dependencies in ghc user manual -- Best regards, Bulat

[Haskell-cafe] Help me speed up my program... or back to the issue of memoization

2008-05-05 Thread Kirill Kuvaldin
Hello, I wrote a program in haskell that works with lattice finite automata (the generalization of notion of finite state automata). Let me post the source code as it is not that long... The problem is that my algorithm that computes the run (see function fun) of an automaton on the given word

[Haskell-cafe] Re: Grokking monads by not overlooking concatMap

2008-05-05 Thread Peter Hercek
Peter Hercek wrote: Achim Schneider wrote: Haskell wins the wickedness of design contest by using [()] and [] as truth values. Maybe you wanted to say: ... by using [()] as True value and [] as False value ... which does not seem that wicked (at least to me). Oops sorry, missed you say

Re: [Haskell-cafe] A Cabal problem

2008-05-05 Thread Trevor Elliott
Hi Mario, Is the name of the module within the Shell.hs file Main? If not, that could be your problem. --trevor On Mon, 05 May 2008 09:57:15 -0400 Mario Blazevic [EMAIL PROTECTED] wrote: I have a problem with Cabal: it doesn't seem to pick up the Main-is: option from the configuration

[Haskell-cafe] Re: Grokking monads by not overlooking concatMap

2008-05-05 Thread Peter Hercek
Achim Schneider wrote: Peter Hercek [EMAIL PROTECTED] wrote: Haskell wins the wickedness of design contest by using [()] and [] as truth values. Maybe you wanted to say: ... by using [()] as True value and [] as False value ... which does not seem that wicked (at least to me). Strangely

[Haskell-cafe] Re: Grokking monads by not overlooking concatMap

2008-05-05 Thread Peter Hercek
Achim Schneider wrote: -- That's the one I've been looking for. Remember that -- return e = [e] f = concatMap (\x - concatMap (\y - concatMap (\_ - [(x,y)]) (if x*y == 8 then [()] else [])) [2..8]) [1..4] Morale:

Re: [Haskell-cafe] A Cabal problem

2008-05-05 Thread Mario Blazevic
Trevor Elliott wrote: Hi Mario, Is the name of the module within the Shell.hs file Main? If not, that could be your problem. You may be right, the module's name is Shell, not Main. GHC does not have problem with that when --main-is Shell option is specified on the command line. Is

Re: [Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Ryan Ingram
On 5/5/08, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: The functional dependency MyString m c | m - c tells GHC that any specific m determines a specific c. It doesn't matter what the type is here, since it's not used in the definition of compareStr; but it must be possible to know that

Re: [Haskell-cafe] Re: Control.Exception.evaluate - 'correct definition' not so correct

2008-05-05 Thread Ryan Ingram
On 5/4/08, Iavor Diatchki [EMAIL PROTECTED] wrote: From the monad law we can conclude only that (= return) is strict, not (=) in general. For example, (=) for the reader monad is not strict in its first argument: m = f = \r - f (m r) r So, (undefined return 2) = (return 2) That's not even

Re: [Haskell-cafe] unapplying function definitions?

2008-05-05 Thread Dan Weston
Hi Paul! I'm not sure about the context of Hutton, but maybe unapplying functions refers to the principle of extensionality. Leibnitz' rule of the indiscernibility of identicals [1] says that if two functions are equal, then the respective results of applying each to *any* value of their

Re: [Haskell-cafe] Using Template Haskell to make type-safe database access

2008-05-05 Thread Mads Lindstrøm
Hi, Wouter Swierstra wrote: Hi Mads, I was wondering if anybody had experimented with using Template Haskell (TH) and ordinary SQL to make type-safe database access? I know HaskellDB, for example, does something quite similar. There's a preprocessor that generates a Haskell file

Re: [Haskell-cafe] Help me speed up my program... or back to the issue of memoization

2008-05-05 Thread Jake Mcarthur
This is only a guess, but an educated guess: there is no silver bullet for memoization in Haskell. There are, however, some somewhat more general approaches you may be interested in. I think this hasn't been researched extremely throughly yet, but see

[Haskell-cafe] Re: Cabalizing darcs

2008-05-05 Thread Ben Franksen
Gwern Branwen wrote: (If yes, any suggestions for a package name? 'darcs' is out, but 'darcs-cb' and 'darcs-cabalized' strike me as horribly clunky or obscure.) barcs :-) Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Parsec on TeX

2008-05-05 Thread Don Stewart
andrewcoppin: Ross Boylan wrote: First, I'm really impressed with the fast and helpful responses from several people! Ask an easy question and you'll get at least a dozen people tripping over each other in their rush to offer you useful advice. Ask a hard question, or an

Re: [Haskell-cafe] A Cabal problem

2008-05-05 Thread Duncan Coutts
On Mon, 2008-05-05 at 13:37 -0400, Mario Blazevic wrote: Trevor Elliott wrote: Hi Mario, Is the name of the module within the Shell.hs file Main? If not, that could be your problem. You may be right, the module's name is Shell, not Main. GHC does not have problem with that

Re: [Haskell-cafe] Help me speed up my program... or back to the issue of memoization

2008-05-05 Thread Sterling Clover
I actually suspect that your supremum and infimum functions are the problem here -- they look like they might be accumulating thunks and blowing your stack. But beyond this, they're also o(n) for what could be effectively an o(log n) operation at the least, if you used ordered sets. I'd start