Re: [Haskell-cafe] Re: monad subexpressions

2007-08-05 Thread Bertram Felgenhauer
Bulat Ziganshin wrote: Hello apfelmus, Saturday, August 4, 2007, 12:18:33 PM, you wrote: Then, mytransaction reads mytransaction = return foo `apT` xvar0 `apT` xvar1 `apT` ... how about a+b*(c+d)? That follows the same pattern, return (+) `apT` a `apT` (return (*)

Re: [Haskell-cafe] Re: Knuth Morris Pratt for Lazy Bytestrings implementation

2007-08-05 Thread Daniel Fischer
Am Mittwoch, 1. August 2007 22:54 schrieb ChrisK: My optimized (and fixed) version of the code is attached. I adapted my KMP implementation from one and a half years ago to the problem at hand (no longer search and replace, only find index of first match, and change from Strings to

Re: [Haskell-cafe] Re: Knuth Morris Pratt for Lazy Bytestrings implementation

2007-08-05 Thread Daniel Fischer
Oooops, stupid error before, fixed below. Missed it due to too few and simple tests, should've quickchecked :-/ Cheers, Daniel -- KMP algorithm for lazy ByteStrings {-# OPTIONS_GHC -fbang-patterns #-} module KMP (kmpMatch) where import qualified Data.Array.Base as Base (unsafeAt) import

[Haskell-cafe] Navigating Haddock

2007-08-05 Thread David Pollak
Howdy, As I'm starting to learn the Haskell libraries, I'm having a less than fun time trying to figure out what functions operate on what types. For example, in the documentation for HaXml, there's a description of Document: http://www.cs.york.ac.uk/fp/HaXml/HaXml/Text-XML-HaXml-Types.html#4

[Haskell-cafe] Interval Arithmetics

2007-08-05 Thread Mitar
Hi! First, disclaimer: everything I know about interval arithmetics comes from this video: http://video.google.com/videoplay?docid=-2285617608766742834 I would like to know if there is any implementation of interval arithmetics in Haskell? I would like to play a little with that. I checked the

[Haskell-cafe] creating graphics the functional way

2007-08-05 Thread Frank Buss
I've created a small program to compose images with combinators: http://www.frank-buss.de/haskell/OlympicRings.hs.txt It produces TGA output, but I've converted it to PNG, because this is smaller: http://www.frank-buss.de/haskell/OlympicRings.png This is my first larger Haskell program and I

Re: [Haskell-cafe] Navigating Haddock

2007-08-05 Thread Marc Weber
On Sun, Aug 05, 2007 at 03:19:25PM -0700, David Pollak wrote: Howdy, As I'm starting to learn the Haskell libraries, I'm having a less than fun time trying to figure out what functions operate on what types. For example, in the documentation for HaXml, there's a description of

Re: [Haskell-cafe] creating graphics the functional way

2007-08-05 Thread Dougal Stanton
On 05/08/07, Frank Buss [EMAIL PROTECTED] wrote: Is it possible to write functions with an arbitrary number of arguments? Would be nice if the average function would accept any number of pixel values. I think it's possible in some sense, because the Haskell interpretation of printf() works in

Re: [Haskell-cafe] creating graphics the functional way

2007-08-05 Thread Marc Weber
On Mon, Aug 06, 2007 at 12:48:02AM +0200, Frank Buss wrote: I've created a small program to compose images with combinators: http://www.frank-buss.de/haskell/OlympicRings.hs.txt It produces TGA output, but I've converted it to PNG, because this is smaller:

Re: [Haskell-cafe] creating graphics the functional way

2007-08-05 Thread Marc Weber
Nearly anything works without thinking too much about the types, but I don't like the use of fromInteger in the average and main functions. Is it I've forgotten to attach this link: http://www.nabble.com/Perl-style-numeric-type-t3948269.html (perhaps use the threaded view to read all

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-05 Thread ok
On 4 Aug 2007, at 12:41 am, Mirko Rahn wrote: rewrite *p++=*q++ in haskell? it's one of C idioms. probably, you don't have enough C experience to understand it :) Maybe, but how can *you* understand it, when the standard is vague about it? It could be A: *p=*q; p+=1; q+=1; B:

[Haskell-cafe] Re: monad subexpressions

2007-08-05 Thread Brian Hulley
On Fri Aug 3 06:06:31 EDT Neil Mitchell wrote: What are the semantics of do b f (- a) where does the evaluation of a get lifted to? I suggest the execution of (a) should be done immediately before the action obtained by applying the monadic function whose argument it is part of:

[Haskell-cafe] Re: Developing Programs and Proofs Spontaneously using GADT

2007-08-05 Thread Shin-Cheng Mu
Thanks for the comments. I will take a look at the type family extension. The definition of plusFn proposed by Jim Apple worked nicely. The solution from apfelmus works after fixing a small typo: newtype Equal a b = Proof (forall f . f a - f b ) newtype Succ f a = InSucc { outSucc :: f (S a)

Re: [Haskell-cafe] How odd...

2007-08-05 Thread ok
On 5 Aug 2007, at 5:26 am, Andrew Coppin wrote: Infinity times any positive quantity gives positive infinity. Infinity times any negative quantity gives negative infinity. Infinity times zero gives zero. What's the problem? That in IEEE arithmetic, infinity times zero is *NOT* zero.