[Haskell-cafe] Re: monads and groups -- instead of loops

2007-08-01 Thread Greg Meredith
Arie, Thanks for your thoughtful reply. Comments in-lined. Best wishes, --greg Date: Thu, 2 Aug 2007 03:06:51 +0200 (CEST) > From: "Arie Peterson" <[EMAIL PROTECTED]> > Subject: Re: [Haskell-cafe] Re: monads and groups -- instead of loops > To: haskell-cafe@haskell.org > Message-ID: < [EMAIL PR

[Haskell-cafe] Re: Zippers, Random Numbers & Terrain

2007-08-01 Thread Chung-chieh Shan
Thomas Conway <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in gmane.comp.lang.haskell.cafe: > On 8/2/07, apfelmus <[EMAIL PROTECTED]> wrote: > > That concludes the infinite terrain generation for one dimension. For > > higher dimension, one just needs to use 2D objects instead of inter

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread ok
On 2 Aug 2007, at 1:20 pm, Alexis Hazell wrote: Category theorists can define monads concisely using the language of their discipline - surely we can settle on a definition of Haskell Monads that would make sense to any programmer who has mastered basic programming concepts? It all depends

Re: [Haskell-cafe] GHC, GLUT and OS X

2007-08-01 Thread Brandon S. Allbery KF8NH
On Aug 2, 2007, at 0:48 , Paul L wrote: Ok, a bit hacking reveals that GLUT on Mac OS X performs differently in GHCi and when compiled. Hm, isn't there a problem with shared library initialization in GHCi? (In a compiled program it's handled by ld.so or equivalent; ghci loads shared obje

Re: [Haskell-cafe] GHC, GLUT and OS X

2007-08-01 Thread Paul L
Ok, a bit hacking reveals that GLUT on Mac OS X performs differently in GHCi and when compiled. I use the following code: import Graphics.UI.GLUT import Graphics.Rendering.OpenGL main = do getArgsAndInitialize createAWindow "Hello window" mainLoop createAWindow windowName = do cre

Re: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread ok
On 2 Aug 2007, at 5:13 am, alpheccar wrote: I think the problem is due to a few bad tutorial still available on the web and which are making two mistakes: 1 - Focusing on the IO monad which is very special ; 2 - Detailing the implementation. As a newie we don't care and we would prefer to se

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread ok
On 2 Aug 2007, at 2:28 am, Andy Gimblett wrote: Is this a reasonable way to compute the cartesian product of a Set? cartesian :: Ord a => S.Set a -> S.Set (a,a) cartesian x = S.fromList [(i,j) | i <- xs, j <- xs] where xs = S.toList x Following up on my recent message about (ab)use of mon

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread ok
Someone asked about comparing monads to loops. If you are chiefly familiar with the i/o and state monads, that doesn't really make a lot of sense, but there IS a use of monads which IS a kind of loop. Only yesterday I was trying to read someone else's Haskell code where they had imported Control

[Haskell-cafe] Parser inversions [Was: CC-delcont-0.1...]

2007-08-01 Thread oleg
Dan Doel wrote about `inverting' a parser -- first, a pure parser consuming a string and later a parser written in a monadic style and consuming a monadic list: data MList' m a = MNil | MCons a (MList m a) type MList m a = m (MList' m a) The second attempt proved fully successful: > So,

[Haskell-cafe] Installing FreeGLUT

2007-08-01 Thread Ronald Guida
Hi, I am trying to use freeglut with GHCi 6.6.1, and I'm stuck. I downloaded freeglut 2.4.0 and compiled it. I am on a Windows XP machine, and I found that freeglut compiled "out of the box" in MS Visual Studio.Net 2003. My difficulty is that GHCi is finding GLUT 2.2.1 and not freeglut. H

Re: [Haskell-cafe] GHC, GLUT and OS X

2007-08-01 Thread Paul L
I use x86 10.4.9, and loading it in GHCi doesn't work at all. It hang after the window pops up. BTW, compiling it using GHC to binary form seems to work. But unfortunately this is not acceptable as loading in GHCi is crucial for the purpose. I'm doing a port of the SOE Graphics from HGL to OpenGL

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

2007-08-01 Thread ajb
G'day all. Quoting ChrisK <[EMAIL PROTECTED]>: > My optimized (and fixed) version of the code is attached. By the way. I don't know if this is relevant, but I'm curious if this approach is any faster: http://72.14.253.104/search?q=cache:kG4zvvkZPLYJ:www.haskell.org/hawiki/RunTimeCompilation I

Re: [Haskell-cafe] Re: monads and groups -- instead of loops

2007-08-01 Thread Dan Weston
If you haven't read it, you might be interested in the paper Alimarine et al, "There and Back Again: Arrows for Invertible Programming" which can be found at http://www.st.cs.ru.nl/papers/2005/alia2005-biarrowsHaskellWorkshop.pdf Dan Weston Greg Meredith wrote: Haskellians, But, along these

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Alexis Hazell
On Thursday 02 August 2007 08:17, Claus Reinke wrote: > a Monad is a type constructor with two operations, implementing > a standard interface and following a few simple rules. . . . . and this is one of the best definitions i've seen yet. Thanks Claus! i think we need to be looking at "What is a

Re: [Haskell-cafe] GHC, GLUT and OS X

2007-08-01 Thread Alan Mock
This works fine for me on PPC and x86 10.4.10. Which GLUT implementation are you using? Does the code hang or does it crash? Alan Mock On Aug 1, 2007, at 7:55 PM, Paul L wrote: I'm trying to get cross platform GLUT/OpenGL program to run, but even the simplest code hang on OS X with GHC 6.6

Re: [Haskell-cafe] Re: monads and groups -- instead of loops

2007-08-01 Thread Arie Peterson
Math alert: mild category theory. Greg Meredith wrote: > But, along these lines i have been wondering for a while... the monad laws > present an alternative categorification of monoid. At least it's > alternative to monoidoid. I wouldn't call monads categorifications of monoids, strictly speakin

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 17:29 -0700, David Pollak wrote: > Duncan, > > Okay... I'm pretty darned impressed. > > I downloaded the packages and got my first Haskell/Glade app running > in about the same amount of time as it took me to get my first VS.Net > app up and running. Excellent :-) > Thanks

[Haskell-cafe] GHC, GLUT and OS X

2007-08-01 Thread Paul L
I'm trying to get cross platform GLUT/OpenGL program to run, but even the simplest code hang on OS X with GHC 6.6 or GHC 6.6.1 import Graphics.UI.GLUT import Graphics.Rendering.OpenGL main = do getArgsAndInitialize createAWindow "Hello window" mainLoop createAWindow windowName = do creat

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread David Pollak
Duncan, Okay... I'm pretty darned impressed. I downloaded the packages and got my first Haskell/Glade app running in about the same amount of time as it took me to get my first VS.Net app up and running. Thanks for the pointer to GTK2hs. I hope to have a nice app to add to the list of Haskell a

Re: [Haskell-cafe] RE: Definition of the Haskell standard library

2007-08-01 Thread Isaac Dupree
Simon Peyton-Jones wrote: When you install packages A,B,C, the documentation for A,B,C (and nothing > else) ought to be locally available as an integrated whole, much as at the GHC web site. I don't know whether Cabal does, or could do, that, but it's surely what one would expect. and would

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Dan Weston
Since S.toAscList x is sorted (and yes, as another poster points out, you should use toAsciList to get that sorting guarantee), you can prove that your cartesian product list is also sorted. Data.Set will almost certainly always have access to the sorted list, but even if not, length x < lengt

Re: [Haskell-cafe] Re: Zippers, Random Numbers & Terrain

2007-08-01 Thread Thomas Conway
On 8/2/07, apfelmus <[EMAIL PROTECTED]> wrote: > That concludes the infinite terrain generation for one dimension. For > higher dimension, one just needs to use 2D objects instead of intervals > to split into two or more pieces. For instance, one can divide > equilateral triangles into 4 smaller on

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dan Weston
I knew someone was going to catch me wandering into the deep end of the pool! Having read large parts of your blog, I would never presume to tell you anything about Haskell or category theory, but what the hell... > I mostly sympathise with your rant, but I think you need to be clearer > abou

Re: [Haskell-cafe] Backpatching

2007-08-01 Thread Thomas Conway
On 8/2/07, Daniel McAllansmith <[EMAIL PROTECTED]> wrote: > On Wednesday 01 August 2007 17:44, Thomas Conway wrote: > > This sounds like a common problem type. Is there a well known solution > > to this sort of problem? > > Have you looked into Tying the Knot? > http://www.haskell.org/haskellwiki/T

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 15:31 -0700, David Pollak wrote: > Duncan, > > Many thanks to you as well! > > On 8/1/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote: > > > * Can GHC generate stand-alone executables with all the

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread David Pollak
On 8/1/07, Stefan O'Rear <[EMAIL PROTECTED]> wrote: > > On Wed, Aug 01, 2007 at 03:31:56PM -0700, David Pollak wrote: > > Duncan, > > > > Many thanks to you as well! > > > > On 8/1/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > > > > > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote: > > >

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread Stefan O'Rear
On Wed, Aug 01, 2007 at 03:31:56PM -0700, David Pollak wrote: > Duncan, > > Many thanks to you as well! > > On 8/1/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > > > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote: > > > > > > > * Can GHC generate stand-alone executables with all th

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread David Pollak
Duncan, Many thanks to you as well! On 8/1/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote: > > > > * Can GHC generate stand-alone executables with all the > > dependencies linked in such that I can distribute the single > >

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Claus Reinke
a Monad is a type constructor with two operations, implementing a standard interface and following a few simple rules. the Monad type class tells you the interface (what operations you've got, and their types), the Monad laws tell you what all types implementing that interface should have in comm

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread David Pollak
Stefan, Thanks for the wicked quick response! On 8/1/07, Stefan O'Rear <[EMAIL PROTECTED]> wrote: > > > >- I found a package to do HTTP requests in Haskell but it does not > >seem to support HTTPS. Is there an HTTPS client package for Haskell? > > Maybe soon; the current HTTP package is

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 13:48 -0700, David Pollak wrote: > So... on to the questions: First of all I recommend you check out these resources: The standard libraries: http://haskell.org/ghc/docs/latest/html/libraries/ A large collection of other libraries: http://hackage.haskell.org/ Another dire

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Rodrigo Queiro
toList generates a sorted list since it is implemented as toList = toAscList, but it's probably bad form to rely on that. On 01/08/07, Andy Gimblett <[EMAIL PROTECTED]> wrote: > On Wed, Aug 01, 2007 at 01:42:52PM -0700, Dan Weston wrote: > > > Andy Gimblett wrote: > > > > > >>cartesian :: Ord a =>

Re: [Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread Stefan O'Rear
On Wed, Aug 01, 2007 at 01:48:07PM -0700, David Pollak wrote: > Howdy, > > I'm considering building a desktop app using Haskell. The primary target > for the app is Windows, but if it runs on Linux and Mac (Intel and PPC), > that'd be a bonus. I've got a bunch of questions that hopefully folks c

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Andy Gimblett
On Wed, Aug 01, 2007 at 01:42:52PM -0700, Dan Weston wrote: > Andy Gimblett wrote: > > > >>cartesian :: Ord a => S.Set a -> S.Set (a,a) > >>cartesian x = S.fromList [(i,j) | i <- xs, j <- xs] > >>where xs = S.toList x > > Your list comprehension always generates a sorted list, so changing > S

Re: [Haskell-cafe] monads and groups -- instead of loops

2007-08-01 Thread Cale Gibbard
On 01/08/07, Greg Meredith <[EMAIL PROTECTED]> wrote: > Haskellians, > > Though the actual metaphor in the monads-via-loops doesn't seem to fly with > this audience, i like the spirit of the communication and the implicit > challenge: find a pithy slogan that -- for a particular audience, like > im

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Jeff Polakow
Hello, > 'Monad' is a type class. > > So what's 'IO'? Is the correct terminology 'instance' as in 'IO is an > instance of Monad'. I consider 'IO' to be 'a monad' as that fits with > mathematical terminology. > I agree with this. >But what about an actual object of type 'IO > Int', say? > I usu

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dan Piponi
On 8/1/07, Dan Weston <[EMAIL PROTECTED]> wrote: > The moral of the story is that monads are less than meets the eye. You > can create them and concatenate them I mostly sympathise with your rant, but I think you need to be clearer about what exactly is concatenated. In general you can't concatena

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

2007-08-01 Thread ChrisK
My optimized (and fixed) version of the code is attached. I benchmarked it with: > module Main(main) where > import KMPSeq > import qualified Data.ByteString.Lazy as B > import qualified Data.ByteString.Lazy.Char8 as BC > infile = "endo.dna" Modified by one character from the original copied

Re: [Haskell-cafe] Backpatching

2007-08-01 Thread Daniel McAllansmith
On Wednesday 01 August 2007 17:44, Thomas Conway wrote: > This sounds like a common problem type. Is there a well known solution > to this sort of problem? Have you looked into Tying the Knot? http://www.haskell.org/haskellwiki/Tying_the_Knot A simple example: module Knot where import Data.Cha

[Haskell-cafe] Some Haskell platformish questions

2007-08-01 Thread David Pollak
Howdy, I'm considering building a desktop app using Haskell. The primary target for the app is Windows, but if it runs on Linux and Mac (Intel and PPC), that'd be a bonus. I've got a bunch of questions that hopefully folks can answer. Well, before I start, you might well be asking "Gee David, y

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Dan Weston
Andy Gimblett wrote: Hi all, Is this a reasonable way to compute the cartesian product of a Set? cartesian :: Ord a => S.Set a -> S.Set (a,a) cartesian x = S.fromList [(i,j) | i <- xs, j <- xs] where xs = S.toList x It's a fairly "obvious" way to do it, but I wondered if there were any h

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dan Weston
> The outermost monad (rightmost bound function) is in the driver seat, and is absolutely free to ignore the monad to its > left (which in turn encloses monads to its left)! This includes of > course the main input IO () monad. Don't believe me? > > Prelude> const 3 (return "Nuclear waste leakin

RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Frank Buss
> How does all this map to C++? A monad is a a class, with no useful > interface for the end user, that looks roughly (i.e. I haven't tested > it) like: trying to implement it in other languages is a good idea for understanding monads. I've tried this with the Maybe monad in Lisp: http://group

Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-01 Thread Seth Gordon
Alex Jacobson wrote: > Ok, so for low throughput applications, you actually need a disk > strategy. Got it. > > Ok, is there a standard interface to BerkleyDB or some other disk based > store? I would absolutely kvell if there were some way to use a disk-based store to back Haskell objects witho

Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 12:32 -0700, Alex Jacobson wrote: > Ok, so for low throughput applications, you actually need a disk > strategy. Got it. > > Ok, is there a standard interface to BerkleyDB or some other disk based > store? Well on hackage there's anydbm and BerkeleyDB. The former is proba

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dan Weston
Here's my rant about the way monads are explained in Haskell tutorials (which are much too polluted with nuclear waste to be safely approached): It is a big mistake to start with the IO monad. It pollutes and misdirects the understanding of what a monad is. The dreaded "nuclear waste" metaphor

Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-01 Thread Alex Jacobson
Ok, so for low throughput applications, you actually need a disk strategy. Got it. Ok, is there a standard interface to BerkleyDB or some other disk based store? -Alex- Duncan Coutts wrote: On Wed, 2007-08-01 at 11:31 -0700, Bryan O'Sullivan wrote: Alex Jacobson wrote: If you create a

[Haskell-cafe] How can I optimize pattern matching on views?

2007-08-01 Thread Ryan Ingram
Background: I participated in this year's ICFP programming contestand our team did quite well, coming in 37th. Our simulator (in somewhat naive C++ with a good algorithm) took about 45 seconds to run the original problem, and afterwards one of my coworkers took the same

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

2007-08-01 Thread ChrisK
I am still working on improving your code. And I have a "Is this a bug?" question: The "lookup = computeLookup pat" defines lookup to take an Int which represents the index into pat, where this index is 0 based and the 0th item is the head of pat. Now look at "matchLength :: Int; matchLength =

[Haskell-cafe] Re: monads and groups -- instead of loops

2007-08-01 Thread Greg Meredith
Haskellians, But, along these lines i have been wondering for a while... the monad laws present an alternative categorification of monoid. At least it's alternative to monoidoid. In the spirit of this thought, does anyone know of an expansion of the monad axioms to include an inverse action? Here,

[Haskell-cafe] Re: Zippers, Random Numbers & Terrain

2007-08-01 Thread apfelmus
Thomas Conway wrote: > This got me thinking that it would be cool to make an infinite terrain > generator using a zipper, so you can zoom in/out infinitely, and by > implication, infinitely in any direction. After some pondering, I think it's indeed possible and the zipper is the right tool for th

Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 11:31 -0700, Bryan O'Sullivan wrote: > Alex Jacobson wrote: > > If you create a Data.Map or Data.Set larger than fits in physical > > memory, will OS level swapping enable your app to behave reasonably or > > will things just die catastrophically as you hit a memory limit? >

Re: [Haskell-cafe] OS swapping and haskell data structures

2007-08-01 Thread Bryan O'Sullivan
Alex Jacobson wrote: If you create a Data.Map or Data.Set larger than fits in physical memory, will OS level swapping enable your app to behave reasonably or will things just die catastrophically as you hit a memory limit? Relying on the OS to page portions of your app in and out should always

Re: [Haskell-cafe] Re: HDBC or HSQL

2007-08-01 Thread Isto Aho
Hi, I'd like to store small matrices into a db. Number of rows and columns may vary in a way not known in advance. One might use a relation (matrixId, col, row, value) or something like that but if it is possible to put a matrix in one command into db, some queries will be easier. E.g., one relati

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

2007-08-01 Thread ChrisK
Justin Bailey wrote: > On 7/31/07, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote: >> jgbailey: >> Also, be sure to compare against a naive search, optimised for >> strict and lazy bytestrings, >> >> http://hpaste.org/1803 >> >> If its not faster than those 2, then you're doing something wrong

Re: [Haskell-cafe] monads and groups -- instead of loops

2007-08-01 Thread Greg Meredith
Andrew, ;-) Agreed! As i said in my previous post, i can't address the imperative programmer. i really don't think that way and have a hard time understanding people who do! (-; Best wishes, --greg On 8/1/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > > That's great, unless the imperative progr

Re: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread alpheccar
Kaveh> "A monad is like a loop that can run a new function against its variable in each iteration." I’m an imperative programmer learning Haskell, so I’m a newbie, but I’ll give it a try ☺ Making mistakes is the best way to learn it ;) I was a newbie not so long ago so I can understan

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Seth Gordon
My own perspective on monads is this: In procedural and OO languages, when dealing with compound data structures, we think in terms of getters (*taking data out* of the structure) and setters (*putting data in* to the structure). Languages with some impure functional features (Lisp, Scheme, Perl,

[Haskell-cafe] renderString problems

2007-08-01 Thread Dave Tapley
Hi all, I'm having a lot of trouble using renderString from Graphics.UI.GLUT.Fonts. All my attempts to render a StrokeFont have so far failed. Using a BitmapFont I can get strings to appear but they demonstrate the odd behaviour of translating themselves a distance equal to their length every time

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Jeff Polakow
Hello, > On 8/1/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > > For me, I think the key to monads is to really > > understand 2 things about them: > > ... > > 2.) Monads are about sequencing > > Now I disagree on 2. > > Monads are no more about sequencing than binary operators are about > seque

Re: [Haskell-cafe] Exiting GLUT application

2007-08-01 Thread Dave Tapley
Unfortunately whilst the new code is returning me to a 'Main >' prompt as required another problem has come up. The issue here is found when the code is executed in both GHCi (6.6) and hugs (20050308). Once the code below is loaded evaluating main opens an unfilled window as required. However if

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dan Piponi
On 8/1/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > For me, I think the key to monads is to really > understand 2 things about them: > ... > 2.) Monads are about sequencing Now I disagree on 2. Monads are no more about sequencing than binary operators are about sequencing. Sure, if you want to,

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Joachim Breitner
Hi, Am Mittwoch, den 01.08.2007, 15:28 +0100 schrieb Andy Gimblett: > Hi all, > > Is this a reasonable way to compute the cartesian product of a Set? > > > cartesian :: Ord a => S.Set a -> S.Set (a,a) > > cartesian x = S.fromList [(i,j) | i <- xs, j <- xs] > > where xs = S.toList x > > It's

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

2007-08-01 Thread Justin Bailey
On 7/31/07, Tim Docker <[EMAIL PROTECTED]> wrote: > Now I wonder what that 7MB file might be? :-) > > We (team TNT) implemented KMP over lazy bytestrings as part of our icfp > 2007 contest entry. As I remember, for the DNA evaluator it gave modest > speed improvements over more naïve searching. Our

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

2007-08-01 Thread Justin Bailey
On 7/31/07, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote: > jgbailey: > Also, be sure to compare against a naive search, optimised for > strict and lazy bytestrings, > > http://hpaste.org/1803 > > If its not faster than those 2, then you're doing something wrong :) > > -- Don Yes, I was real

Re: FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Andrew Wagner
> > "an IO monad is a delayed action that will be executed as soon as that action > is needed for further evaluation of the program." > I'm not sure I like this, as it seems to confuse the issue. An expert should correct me if I'm wrong, but monads in and of themselves don't depend on laziness. R

Re: [Haskell-cafe] monads and groups -- instead of loops

2007-08-01 Thread Andrew Wagner
That's great, unless the imperative programmer happens to be one of the 90% of programmers that isn't particularly familiar with group theory... On 8/1/07, Greg Meredith <[EMAIL PROTECTED]> wrote: > Haskellians, > > Though the actual metaphor in the monads-via-loops doesn't seem to fly with > this

Re: Re : Re : Re : [Haskell-cafe] Indentation woes

2007-08-01 Thread david48
On 8/1/07, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote: > > On Aug 1, 2007, at 10:05 , david48 wrote: > > > On the topic of indenting, it would be nice if there was a way to tell > > the compiler the size of the tab characters. > > > > The way it is now, I have to use space characters to ind

Re: Re : Re : Re : [Haskell-cafe] Indentation woes

2007-08-01 Thread Brandon S. Allbery KF8NH
On Aug 1, 2007, at 10:05 , david48 wrote: On the topic of indenting, it would be nice if there was a way to tell the compiler the size of the tab characters. The way it is now, I have to use space characters to indent. The problem with that is, while there's a standard for the width of a t

[Haskell-cafe] monads and groups -- instead of loops

2007-08-01 Thread Greg Meredith
Haskellians, Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the noti

[Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Andy Gimblett
Hi all, Is this a reasonable way to compute the cartesian product of a Set? > cartesian :: Ord a => S.Set a -> S.Set (a,a) > cartesian x = S.fromList [(i,j) | i <- xs, j <- xs] > where xs = S.toList x It's a fairly "obvious" way to do it, but I wondered if there were any hidden gotchas. I'm

FW: RE [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread peterv
Kaveh> "A monad is like a loop that can run a new function against its variable in each iteration." I’m an imperative programmer learning Haskell, so I’m a newbie, but I’ll give it a try ☺ Making mistakes is the best way to learn it ;) There are lots of different kinds of monads, but let’s sti

Re: Re : Re : Re : [Haskell-cafe] Indentation woes

2007-08-01 Thread Duncan Coutts
On Wed, 2007-08-01 at 16:05 +0200, david48 wrote: > On the topic of indenting, it would be nice if there was a way to tell > the compiler the size of the tab characters. > > The way it is now, I have to use space characters to indent. Good! You're doing exactly the right thing according to the Ha

Re: Re : Re : Re : [Haskell-cafe] Indentation woes

2007-08-01 Thread david48
On the topic of indenting, it would be nice if there was a way to tell the compiler the size of the tab characters. The way it is now, I have to use space characters to indent. It's not really a problem though. ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread david48
On 8/1/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > > you can imagine each of the calls to putStrLn gets implicitly passed a > > variable (here, the world ) and they happen in succession so it's > > "like a loop". > It breaks down further as soon as you add any amount of complexity to > the cod

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Andrew Wagner
> say you have this code : > >putStrLn "1" >> putStrLn "2" >> putStrLn "3" > > you can imagine each of the calls to putStrLn gets implicitly passed a > variable (here, the world ) and they happen in succession so it's > "like a loop". It breaks down further as soon as you add any amount of com

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Christopher L Conway
On 8/1/07, david48 <[EMAIL PROTECTED]> wrote: > As a beginner haskeller coming from an imperative experience, I think > I understood what he meant. > > say you have this code : > >putStrLn "1" >> putStrLn "2" >> putStrLn "3" > > you can imagine each of the calls to putStrLn gets implicitly pass

Re: [Haskell-cafe] Backpatching

2007-08-01 Thread Jim Burton
Derek Elkins wrote: > > On Tue, 2007-07-31 at 23:04 -0700, Stefan O'Rear wrote: >> On Wed, Aug 01, 2007 at 03:44:32PM +1000, Thomas Conway wrote: >> > This sounds like a common problem type. Is there a well known solution >> > to this sort of problem? >> >> Mmm... logic programming? >> >> http

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread david48
On 8/1/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > This seems wrong to me. A monad is, first and foremost, a type > constructor class. I'm not sure how you can really compare that to a > loop. But perhaps the easiest way to test your definition would be to > ask this: How is, for example, the Ma

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Dougal Stanton
On 01/08/07, Andrew Wagner <[EMAIL PROTECTED]> wrote: > This seems wrong to me. A monad is, first and foremost, a type > constructor class. I'm not sure how you can really compare that to a > loop. But perhaps the easiest way to test your definition would be to > ask this: How is, for example, the

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Andrew Wagner
This seems wrong to me. A monad is, first and foremost, a type constructor class. I'm not sure how you can really compare that to a loop. But perhaps the easiest way to test your definition would be to ask this: How is, for example, the Maybe monad like a loop, in your definition? On 8/1/07, Kaveh

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-08-01 Thread Jon Fairbairn
David Roundy <[EMAIL PROTECTED]> writes: > On Mon, Jul 30, 2007 at 11:47:46AM +0100, Jon Fairbairn wrote: > > [snippage] This is all very horrid, but as far as I can tell > > what I was proposing wouldn't lead to such a mess, except > > possibly via defaulting, which, as the least important > > as

[Haskell-cafe] Re: Backpatching

2007-08-01 Thread ChrisK
Thomas Conway wrote: > One of the things that gets messy is that in lots of places you can > put either a thing or a reference to a thing (i.e. the name of a thing > defined elsewhere). For example, consider the production: > > NamedNumber ::= identifier "(" SignedNumber ")" >

[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

2007-08-01 Thread ChrisK
Discussion continues below quoted text... Stefan O'Rear wrote: > On Tue, Jul 31, 2007 at 03:31:54PM -0700, David Roundy wrote: >> On Mon, Jul 30, 2007 at 11:47:46AM +0100, Jon Fairbairn wrote: >>> ChrisK <[EMAIL PROTECTED]> writes: >>> And the readability is destroyed because you cannot do an

Re: [Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Alexis Hazell
On Wednesday 01 August 2007 17:02, Kaveh Shahbazian wrote: > This is about to put a definition/description to test. So please cooperate! > ;) > Is this a useful – sufficient, not complete – definition/description for a > monad; for an imperative mind: (?) > > "A monad is like a loop that can run a

Re[2]: [Haskell-cafe] Re: HDBC or HSQL

2007-08-01 Thread Bulat Ziganshin
Hello Alex, Wednesday, August 1, 2007, 8:34:23 AM, you wrote: > I am asking because I am trying to make HAppS a reasonable replacement > for all contexts in which you would otherwise use an external relational > database except those in which an external SQL database is a specific > requirement.

[Haskell-cafe] Monad Description For Imperative Programmer

2007-08-01 Thread Kaveh Shahbazian
This is about to put a definition/description to test. So please cooperate! ;) Is this a useful – sufficient, not complete – definition/description for a monad; for an imperative mind: (?) "A monad is like a loop that can run a new function against it's variable in each iteration." (I insist on t