Re: [Haskell-cafe] Substring replacements

2005-12-22 Thread Daniel Fischer
Am Mittwoch, 21. Dezember 2005 15:20 schrieb Daniel Fischer: i'm 90% sure that straightforward method must be faster for one-time searches. I'm far less sure of that. If you have a really short search-pattern, I think that probably straightforward search is indeed faster (at least, if the

Re: [Haskell-cafe] Re: When to teach IO

2005-12-22 Thread Ketil Malde
Bayley, Alistair [EMAIL PROTECTED] writes: Hear, hear. Compilers, and computationally complex programs in general, are atypical. IMO, a lot of programming these days is integration work i.e. shuffling and transforming data from one system to another, or transforming data for reports, etc. Not

[Haskell-cafe] Arrows and pickler combinators

2005-12-22 Thread Joel Reymont
Folks, I'm trying to monadify the pickler code. sequ below positively looks like = but you can't really join both pickle and unpickle into a single monad. I would like to keep the ops together, though, as this allows me a single specification for both pickling and unpickling. Cale

[Haskell-cafe] Re: When to teach IO

2005-12-22 Thread jerzy . karczmarczuk
Ketil Malde writes: I'm sorry, but, if we define compiler as a input-process-output pipeline, then: shuffling and transforming data = compiler transforming data for reports = compiler I actually think a lot of useful programs fit into that category. Ketil, calling compiler all this

RE: [Haskell-cafe] When to teach IO

2005-12-22 Thread Bayley, Alistair
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] PS. About the subject (when to teach IO): don't be sectarians. If a programming course insists on algorithmics, the IO issues can be postponed a bit. If it insists on practical data processing, IO should come in

[Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Daniel Carrera
S Koray Can wrote: As a newbie... I agree that a newbie should be able to write this fairly early on: main = do x - getLine() putStrLn (The answer is ++ show(fib(read(x I'd agree for some definition of 'early'. I'll elaborate: [snip] The above code snippet contains

Re: [Haskell-cafe] When to teach IO

2005-12-22 Thread jerzy . karczmarczuk
Bayley, Alistair asks (commenting my statement): _What_ is easier in Scheme than in Haskell? IO, or teaching (IO)? In my humble opinion, both. Mainly for psychological reasons, we (well, we, students more than we, old Haskell cowboys...) are used to the sequentiality of I/O. As people

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Sebastian Sylvan
On 12/22/05, Daniel Carrera [EMAIL PROTECTED] wrote: S Koray Can wrote: As a newbie... I agree that a newbie should be able to write this fairly early on: main = do x - getLine() putStrLn (The answer is ++ show(fib(read(x I'd agree for some definition of

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Paul Moore
On 12/22/05, John Meacham [EMAIL PROTECTED] wrote: Just the idea that you can write things like mapM and replicateM is enough to blow the mind of many impertive programmers. Not trying to fan the flames, but one thing I struggle with is understanding (at a gut level - if you explain the theory,

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread J. Garrett Morris
On 12/22/05, Daniel Carrera [EMAIL PROTECTED] wrote: Hi all, How do I write a statement that spans multiple lines? I have this function: pythagoras n = [(a,b,c) | a -[1..n], b -[1..n], c -[1..n], a = b, b c, a*a + b*b == c*c] This should all be in one line. I know some ways to make the

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Daniel Carrera
J. Garrett Morris wrote: Indent the second line: pythagoras n = [(a,b,c) | a -[1..n], b -[1..n], c -[1..n], a = b, b c, a*a + b*b == c*c] Thanks! Daniel. -- /\/`) http://oooauthors.org /\/_/ http://opendocumentfellowship.org /\/_/ \/_/I am

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Greg Buchholz
Daniel Carrera wrote: Hi all, How do I write a statement that spans multiple lines? I have this function: pythagoras n = [(a,b,c) | a -[1..n], b -[1..n], c -[1..n], a = b, b c, a*a + b*b == c*c] This should all be in one line. I know some ways to make the line shorter, like

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Greg Buchholz
You might also like to try the slightly more efficient... pyth n = [(a,b,c) | a - [1..n], b - [a..n], c - [a+1..n], a*a + b*b == c*c ] Greg Buchholz ___ Haskell-Cafe

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Donn Cave
On Thu, 22 Dec 2005, Paul Moore wrote: ... FWIW, I don't really see why the -M functions are needed either. It's something to do with the fact that map is for lists, and mapM is for monads, which are a more general type of sequence than a list. But why mapM isn't therefore a superset of map,

Re: [Haskell-cafe] exuberant-ctags, haskell, vim, tlist plugin

2005-12-22 Thread Claus Reinke
If you try a recent snapshot of cvs ghc, its ghci should support generating project-wide tags files for emacs and vim (btw, the online help for vim has another example of using tags for code browsing: showing the definition for the identifier under cursor in a preview window - very handy for

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread John Meacham
On Thu, Dec 22, 2005 at 02:02:56PM +, Daniel Carrera wrote: I had never heard of mapM, or other -M functions. I can't imagine why those would be needed. It seems like pointless duplication. (!!!) then you are missing out. the M functions (and monadic traversal functions in general)

Re: [Haskell-cafe] Statements spanning multiple lines?

2005-12-22 Thread Daniel Carrera
Greg Buchholz wrote: You might also like to try the slightly more efficient... pyth n = [(a,b,c) | a - [1..n], b - [a..n], c - [a+1..n], a*a + b*b == c*c ] Cool. I'm amazed that actually works. I've been writing

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Sebastian Sylvan
On 12/22/05, Daniel Carrera [EMAIL PROTECTED] wrote: Paul Moore wrote: As I say, I'm not trying to criticize anyone here, but it seems to be quite hard to get across to people who have understood and assimilated this sort of stuff, just how hard it feels to newcomers. We understand the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Jared Updike
SKC This entire discussion is about 'breaking a cyclic graph of conceptual SKC dependencies'. Unfortunately, I don't think it can be done well in short SKC amount of time. I bet if we sat down and listed all the concepts required to write idiomatic Haskell (even idiomatic Haskell 98 (whatever

[Haskell-cafe] FAQ: Why no interactive definitions?

2005-12-22 Thread Greg Woodhouse
In neither GHCi nor Hugs (so far as I know) is it possible to interactively enter definitions. coming from Scheme, this was a bit of a surprise, as I'm used to being able to enter, say (define mysquare (lambda (x) (* x x))) Is this just a matter of the feature not being implemented, or

Re: [Haskell-cafe] FAQ: Why no interactive definitions?

2005-12-22 Thread J. Garrett Morris
In ghci at least, you can enter definitions like that using let binding: let mysquare x = x * x /g On 12/22/05, Greg Woodhouse [EMAIL PROTECTED] wrote: In neither GHCi nor Hugs (so far as I know) is it possible to interactively enter definitions. coming from Scheme, this was a bit of a

Re: [Haskell-cafe] FAQ: Why no interactive definitions?

2005-12-22 Thread Jared Updike
There was a good discussion about this on an earlier thread. http://www.mail-archive.com/haskell-cafe@haskell.org/msg11372.html In fact, this exact question sparked a number of long threads. :-) (First steps in Haskell, Tutorial upload, Proposal for a First Tutorial.) Cheers, Jared. -- [EMAIL

[Haskell-cafe] ANN: HDBC 0.6.0

2005-12-22 Thread John Goerzen
Hello, Version 0.6.0 of HDBC and the Sqlite3 bindings are now available. New features since Tuesday's 0.5.0 announcement include: * New type system for marshalling different Haskell types back and forth * New support for querying meta-information about the server * Much improved

Re: [Haskell-cafe] Arrows and pickler combinators

2005-12-22 Thread Jeremy Shaw
At Thu, 22 Dec 2005 11:26:51 +, Joel Reymont wrote: Folks, I'm trying to monadify the pickler code. sequ below positively looks like = but you can't really join both pickle and unpickle into a single monad. I would like to keep the ops together, though, as this allows me a

[Haskell-cafe] Encapsulation in Haskell

2005-12-22 Thread Creighton Hogg
Hi guys, So one of the big things in object oriented programming is encapsulation, and I'm wondering how to do it properly in Haskell. How do you define new data types but minimize the dependence of external packages on the exact nature of the data definition?

[Haskell-cafe] Type inference for infinite structures

2005-12-22 Thread Matt Collins
Hi everyone, I'm relatively new to Haskell and was a bit troubled by the problem of assigning a type to infinite structures. To give a clear example, suppose we have data Nat = Zero | Succ Nat omega = Succ omega What type then does omega have? According to GHCi, omega :: Nat. But surely

Re: [Haskell-cafe] Type inference for infinite structures

2005-12-22 Thread Sebastian Sylvan
On 12/23/05, Matt Collins [EMAIL PROTECTED] wrote: Hi everyone, I'm relatively new to Haskell and was a bit troubled by the problem of assigning a type to infinite structures. To give a clear example, suppose we have data Nat = Zero | Succ Nat omega = Succ omega What type then does omega

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Udo Stenzel
Paul Moore wrote: Not trying to fan the flames, but one thing I struggle with is understanding (at a gut level - if you explain the theory, I'll understand, but go away none the wiser in practice...) why I need mapM as well as map (and all the other -M functions, liftM, foldM, etc...) All you

[Haskell-cafe] Re: kinds question

2005-12-22 Thread Ashley Yakeley
David Roundy wrote: Hello all, I have a question about how to create the right kind to declare lists to be a class. I have a class Foo class Foo f where foo :: f a - Foo and I want to define that a list of Foos is also a Foo, but can't see how to do it. I imagine something like instance

Re: [Haskell-cafe] Type inference for infinite structures

2005-12-22 Thread Matt Collins
Thanks Sebastian, I guess I was ignoring the type of Succ like you said. Glad to have passed that mental barrier! On 23/12/2005, at 12:14 PM, Sebastian Sylvan wrote: On 12/23/05, Matt Collins [EMAIL PROTECTED] wrote: Hi everyone, I'm relatively new to Haskell and was a bit troubled by the

[Haskell-cafe] zigzag data structure

2005-12-22 Thread Brian McQueen
I'm curious what this user community would come up with in order to implement the curious zigzag data structure. If you haven't heard anything about it, its a simple but peculiar idea, by the guy who dreamed up the Xanadu project: http://xanadu.com/zigzag/. Conceptually it is cells with some

Re: [Haskell-cafe] zigzag data structure

2005-12-22 Thread Cale Gibbard
That sounds like a special case of what is called a graph in mathematics and computer science. See: http://en.wikipedia.org/wiki/Graph_%28mathematics%29 and http://en.wikipedia.org/wiki/Graph_%28data_structure%29 Essentially, the structure that they define on that site is a graph with arcs

Re: [Haskell-cafe] zigzag data structure

2005-12-22 Thread Cale Gibbard
Essentially, the structure that they define on that site is a graph with arcs labelled in such a way that any vertex has at most one outgoing arc with that label (and hence at most one incoming arc with that label as well). Sorry, I obviously didn't read that carefully enough, and both