Re: [Haskell-cafe] The Riddle of the Buddhist Monk

2011-12-20 Thread Paul Johnson
On 20/12/11 10:16, Patrick Browne wrote: Hi, I am trying to implement a set of 4 modules that blend the action of a monk moving up a mountain on day 1 and returning down by the same path on day 2 [1][2]. The code should reflect the fact that there is some time and place which is common to the

Re: [Haskell-cafe] German names for kinds and sorts

2011-11-13 Thread Paul Johnson
An odd suggestion I know, but take a look at some bibles. The King James Bible uses the word kind to describe different animals in Genesis 1: ^24 And God said, Let the earth bring forth the living creature after his kind, cattle, and creeping thing, and beast of the earth after his kind: and

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Paul Johnson
I would have thought that the compiler, as a matter of optimisation, could insert a check to see if (==) is comparing an object with itself. The only way I can see this breaking is with perverse instances of Eq that would return False for f == f. Paul. On 07/20/2011 04:51 AM, Nikhil A.

[Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Paul Johnson
If you open a file for writing and then exit with output unflushed, then Haskell does not flush the file for you. In ghci the program seems to work, but then when you compile it in ghc it mysteriously fails. I've just been bitten by this, but when I went to the bug tracker I found

Re: [Haskell-cafe] How do you test a parser?

2011-06-11 Thread Paul Johnson
On 11/06/11 14:10, Andrew Coppin wrote: OK, so suppose you sit down and write a complicated string parser. Now how do you test that it works correctly? If you have a function that turns a parse tree back into text again, you can try verifying that a round-trip is the identity function.

[Haskell-cafe] Haskell Platform web page is out of date

2011-03-09 Thread Paul Johnson
The Haskell Platform web page at http://hackage.haskell.org/platform// seems to need updating. (Incidentally, that double slash at the end doesn't look right). * The next release is promised in Jan 2011. * The Release Timetable schedules the next release for 5 March 2011. I just worry that

[Haskell-cafe] Can't install Leksah

2010-11-27 Thread Paul Johnson
I installed gtk2hs-buildtools as per the Leksah page, and then tried to install Leksah itself. I got: [r...@eiffel download]# cabal install leksah Resolving dependencies... cabal: cannot configure leksah-server-0.8.0.8. It requires ghc=6.10.1 6.13 There is no available version of ghc that

Re: [Haskell-cafe] Can't install Leksah

2010-11-27 Thread Paul Johnson
On 27/11/10 11:25, Christopher Done wrote: Interesting. Perhaps Cabal isn't looking at the same GHC version. If you run cabal install with --version passed to GHC, GHC will just output the version instead of doing any compiling and the install will stop. You can see what version Cabal actually

Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)

2010-08-30 Thread Paul Johnson
On 27/08/10 23:45, sylvain wrote: Other sources show growing interest in Haskell (much to the dismay of our favorite motto). Would you accept to refer to these other sources? One interesting one is http://www.itjobswatch.co.uk/jobs/uk/haskell.do Paul.

Re: [Haskell-cafe] ANNOUNCE: DSTM 0.1.1

2010-08-05 Thread Paul Johnson
Looks interesting. One point: you seem to be using Read and Show typeclasses for serialisation. I think you would be better off using Binary, which is much more efficient. Paul. On 03/08/10 09:35, Frank Kupke wrote: Hi, DSTM is an implementation of a robust distributed Software

Re: [Haskell-cafe] Small flexible projects a possible niche for Haskell - your statement, please...

2010-07-17 Thread Paul Johnson
On 16/07/10 05:41, Nick Rudnick wrote: In consequence, an 8-student-project with two B.Sc. theses is raised as a pilot to examine the possibilities of using Haskell in the combination small team with limited resources and experience in a startup setting - we want to find out whether Haskell

Re: [Haskell-cafe] How easy is it to hire Haskell programmers

2010-07-02 Thread Paul Johnson
On 02/07/10 14:43, Edward Kmett wrote: Knowledge of Haskell means very different things to different people. I'd be somewhat leery of blindly hiring someone based on their ability to answer a couple of pop Haskell quiz questions. Fair enough, and I should probably have put a smiley in

[Haskell-cafe] How easy is it to hire Haskell programmers

2010-06-30 Thread Paul Johnson
I'm starting to see job adverts mentioning Haskell as a nice to have, and even in some cases as a technology to work with. However right now I'm looking at it from the other side. Suppose someone wants to hire a Haskell developer or three. How easy is this? I'd appreciate replies from

Re: [Haskell-cafe] Accounting Engine in Haskell

2010-06-23 Thread Paul Johnson
On 15/06/10 09:08, Amiruddin Nagri wrote: I wanted some insight as to how Haskell is going to help me with my project. Also there has been some concerns because of lazy evaluation in Haskell and memory leaks associated with it.

Re: [Haskell-cafe] Continuations and coroutines

2010-06-20 Thread Paul Johnson
On 19/06/10 17:23, Yves Parès wrote: It helps me understand better, but would you have some simple code that would do that ? http://www.cs.chalmers.se/~koen/pubs/jfp99-monad.ps Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Continuations and coroutines

2010-06-20 Thread Paul Johnson
On 20/06/10 22:03, Paul Johnson wrote: On 19/06/10 17:23, Yves Parès wrote: It helps me understand better, but would you have some simple code that would do that ? http://www.cs.chalmers.se/~koen/pubs/jfp99-monad.ps Except that the paper I'm trying to refer to seems to have fallen off

Re: [Haskell-cafe] Continuations and coroutines

2010-06-19 Thread Paul Johnson
On 19/06/10 10:36, Yves Parès wrote: Hello, I saw on the haskell wikibook that coroutines could be implemented by using continuations : http://en.wikibooks.org/wiki/Haskell/Continuation_passing_style#Example:_coroutines (unhappily, the section is empty) Since I'm actually learning the

Re: [Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-19 Thread Paul Johnson
On 16/04/10 19:59, Daniel Fischer wrote: Am Freitag 16 April 2010 20:50:25 schrieb Brian Hulley: revealed a link to a US Patent (7120900) for the idea of implementing the Unicode Bidirectional Algorithm (UAX #9 http://www.unicode.org/reports/tr9) in Haskell, making use, as far as I can

Re: [Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-19 Thread Paul Johnson
This patent has zero practical impact. When the patent was written there was no Unicode support, so the implementation translates the input into lists of integers instead of lists of characters. Crucially this step was also written into all three independent claims (which are the only bit of

Re: [Haskell-cafe] Data.Binary.GetT or ... ?

2010-03-13 Thread Paul Johnson
On 13/03/10 10:06, Juraj Hercek wrote: Hello, I'm thinking about using Data.Binary to parse binary stream of data. Binary data stream consists of messages which can have one or more (sometimes couple of hundreds) sub-messages. The stream is spitting out data slowly. I would like to parse

Re: [Haskell-cafe] First time haskell - parse error!

2010-03-09 Thread Paul Johnson
Thats because you can't put a where in a then clause. Move the where stuff to the end of the function. On 09/03/10 19:04, boblettoj wrote: Hi, i am getting an error when trying to compile this part of my program, its my first time using haskell and as lovely as it is it didn't give me very

Re: [Haskell-cafe] What happened in Ohloh?

2010-02-20 Thread Paul Johnson
On 19/02/10 22:31, Don Stewart wrote: paul: I'd like to use this kind of graph at work as evidence that Haskell is on a growth trajectory. You might be more interested in data from Hackage: http://www.galois.com/blog/2009/03/23/one-million-haskell-downloads/ runched when we

[Haskell-cafe] What happened in Ohloh?

2010-02-19 Thread Paul Johnson
If you go to http://www.ohloh.net/languages/compare?l0=haskellmeasure=projects and look at the number (not percentage) of Haskell projects you see it rise exponentially until the start of 2008 and then suddenly drop away. Does anyone know what happened? Assuming this is just an artefact

Re: [Haskell-cafe] Please help me debug my arrow

2010-01-20 Thread Paul Johnson
On 18/01/10 20:33, Paul Johnson wrote: I'm going nuts looking at this. Can anyone see what I'm doing wrong? I found the problem eventually. Its a scoping problem with rt1 in the (.) function when composeSP gets called recursively. ___ Haskell

[Haskell-cafe] Please help me debug my arrow

2010-01-18 Thread Paul Johnson
Hi, I'm trying to write an arrow for a real-time stream processor. I'm basing it on the SP type in Hughes paper on Generalising Monads to Arrows (http://www.cs.chalmers.se/~rjmh/Papers/arrows.pdf) section 6. I've extended this with a notion of time by making each step a function of time.

Re: [Haskell-cafe] consulting and contracting

2009-12-15 Thread Paul Johnson
On 15/12/09 21:19, Anton van Straaten wrote: Without that advocacy, this client would have used Java by default. As it was, the first of those two systems was developed in parallel with a Java version, and we used the two versions to verify each other's results. For the second system, a

Re: [Haskell-cafe] Why?

2009-12-11 Thread Paul Johnson
On 10/12/09 12:07, Magnus Therning wrote: As I understand it it all started with laziness. I don't know if laziness is impossible without purity, but talks and papers tend to say something like laziness has kept Haskell pure. This is true, but laziness has its own advantages. Suppose I have

Re: [Haskell-cafe] You are in a twisty maze of concurrency libraries, all different ...

2009-12-04 Thread Paul Johnson
On 04/12/09 11:51, Patrick Caldon wrote: I'm looking for the right concurrency library/semantics for what should be a reasonably simple problem. I have a little simulator: runWorldSim :: MTGen - SimState - IO SimState it takes about a second to run on a PC. It's functional except it

Re: [Haskell-cafe] seems like I'm on the wrong track

2009-12-04 Thread Paul Johnson
On 02/12/09 01:55, Michael Mossey wrote: I have a quite messy problem which is describable as a big state machine, at least in the way I think of it. An input event can trigger a cascade of changes to the state. Channel numbers must be assigned and tracked, table numbers as well, decisions

Re: [Haskell-cafe] Haskell as an alternative to Java

2009-11-21 Thread Paul Johnson
On 18/11/09 11:54, Philippos Apolinarius wrote: I wonder whether the Haskell community tryed to reproduce the study Lisp as an alternative to Java, by Ron Garret / Erann Gat. Sort of. See http://www.haskell.org/haskellwiki/Phone_number Paul.

[Haskell-cafe] Time and space complexity of take k . sort

2009-10-22 Thread Paul Johnson
This question on StackOverflow asked about how to find the largest 100 items in a very long list: http://stackoverflow.com/questions/1602998/fastest-way-to-obtain-the-largest-x-numbers-from-a-very-large-unsorted-list/1603198#1603198 I replied that you could do it with something like this (but

Re: [Haskell-cafe] Time and space complexity of take k . sort

2009-10-22 Thread Paul Johnson
On 22/10/09 15:31, Paul Johnson wrote: takeLargest k = take k . sort Because sort is lazily evaluated this only does enough sorting to find the first k elements. I guess the complexity is something like O(n*k*log(k)). Correction: O(n*log(k

Re: [Haskell-cafe] Haskell-tan competition

2009-10-11 Thread Paul Johnson
What about Lambdabot? On 10/10/09 20:22, Miguel Mitrofanov wrote: Just a note: Haskell and 'tan' in one sentence, combined with some girlish flavour, makes me think about Audrey TANg. On 10 Oct 2009, at 23:02, Svein Ove Aas wrote: I say competition, but.. at the moment I'm only aware of a

Re: [Haskell-cafe] Test.QuickCheck: generate

2009-10-08 Thread Paul Johnson
On 08/10/09 04:57, David Menendez wrote: On Wed, Oct 7, 2009 at 8:29 PM, Michael Mosseym...@alumni.caltech.edu wrote: In Test.QuickCheck, the type of 'generate' is generate :: Int - StdGen - Gen a - a I can't find docs that explain what the Int does. Some docs are here: Judging

Re: [Haskell-cafe] Haskell for Physicists

2009-10-01 Thread Paul Johnson
I can't help with the title, but you might show how Haskell can help avoid the subtle bugs that create erroneous results. Start with the dimensional library (http://hackage.haskell.org/package/dimensional). Paul. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Proof in Haskell

2009-09-25 Thread Paul Johnson
One alternative approach is to use QuickCheck to test many trees and look for counter-examples. You can also use SmallCheck to do an exhaustive check up to a chosen size of tree. To do this with QuickCheck you would write a function such as prop_mirror :: Node a - Bool prop_mirror x =

Re: [Haskell-cafe] Is it possible to do type-level arithmetic without UndeciableInstances?

2009-06-05 Thread Paul Johnson
This is a bit beyond my normal level of expertise, but if I understand it correctly the type checker is normally limited to type functions that are primitive recursive (http://en.wikipedia.org/wiki/Primitive_recursive_function). This means that they are guaranteed to terminate, but on the

Re: [Haskell-cafe] Building a better dog house?

2009-05-17 Thread Paul Johnson
michael rice wrote: I was just looking at my UML (Unified Modeling Language) User Guide and discovered this: The number of object-oriented methods increased from fewer than 10 to more than 50 during the period between 1989 and 1994. pg. xviii, Booch, Rumbaugh, Jacobson, 1999 Is there a

Re: [Haskell-cafe] looking for suggestion on pattern matching problem

2009-05-14 Thread Paul Johnson
Sounds like you need regular expressions applied to the string representation, although the sequence of increasing numbers is not something any of the standard regexp packages do. So you will have to roll your own. Alternatively you could use one of the parsing libraries to parse the string

Re: [Haskell-cafe] [SoC] XML Schema Implementation

2009-03-31 Thread Paul Johnson
On Mar 31, 2009, at 12:16 AM, Vlad Dogaru wrote: More specifically, I would be interested in the degree the Haskell community uses XML Schema, and if you were tempted to use it if we had an implementation. To further expand the question, how useful do you consider each of these components: * a

Re: [Haskell-cafe] Looking for a co-founder for a startup using Haskell

2009-03-06 Thread Paul Johnson
Ed McCaffrey wrote: Other investors I have spoken with want me to contact them again when it is further developed; That means no. See http://blog.guykawasaki.com/2006/01/the_top_ten_lie.html Paul. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] MPTC inheritance

2009-02-24 Thread Paul Johnson
Derek Gladding wrote: Please forgive me if I'm still mentally contaminated by the OO way of seeing (and discussing) the universe, but I'm trying to figure out how to inherit an interface from a multi-parameter type class. [...] but this isn't allowed (kind mismatch). Kinds are a meta-type

[Haskell-cafe] instance MonadFix GenParser

2009-02-22 Thread Paul Johnson
I want to write a parser for a Haskell-like type language. Amongst other things this means having a symbol table of top-level declarations. So for instance I want to be able to write in my type language: type Foo = Bar Int data Bar a = Bar String a I can come up with a parser that

Re: [Haskell-cafe] instance MonadFix GenParser

2009-02-22 Thread Paul Johnson
Oops. The last code sample should have been parseDeclarations :: Parser [Declaration] parseDeclarations = mdo decls - many ParseDeclaration symbols let symbols = makeSymbolTable decls return decls ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: permuting a list

2009-02-15 Thread Paul Johnson
See http://okmij.org/ftp/Haskell/perfect-shuffle.txt Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Race condition possible?

2009-02-14 Thread Paul Johnson
Peter Verswyvelen wrote: Consider the following code stamp v x = do t - getCurrentTime putMVar v (x,t) Is it possible - with GHC - that a thread switch happens after the t - getCurrentTime and the putMVar v (x,t)? If so, how would it be possible to make sure that the operation of

Re: [Haskell-cafe] The Haskell re-branding exercise

2009-02-07 Thread Paul Johnson
Paul Johnson wrote: A call has gone out http://www.haskell.org/pipermail/haskell-cafe/2008-December/051836.html for a new logo for Haskell. Candidates (including a couple http://www.haskell.org/haskellwiki/Image:Haskell-logo-revolution.png of mine http://www.haskell.org/sitewiki/images/f/fd

Re: [Haskell-cafe] pure crisis :)

2009-02-01 Thread Paul Johnson
Bulat Ziganshin wrote: Hello haskell-cafe, pure functional denotation for crisis: (_|_) See also: http://www.haskell.org/haskellwiki/Humor/Enron http://paulspontifications.blogspot.com/2008/09/why-banks-collapsed-and-how-paper-on.html Paul.

Re: [Haskell-cafe] Employment

2009-01-20 Thread Paul Johnson
Tom Hawkins wrote: Such a database would help me counter by boss's argument that it's impossible to find and hire Haskell programmers. There was a thread last week where someone asked who would be interested in a hypothetical Haskell job. He got about 20 positive responses. This agrees

Re: [Haskell-cafe] teaching functional programming at work

2009-01-04 Thread Paul Johnson
Warren Harris wrote: I am seeking suggestions from the haskell cafe for teaching functional programming concepts to colleagues at work. I'd suggest starting with a couple of hours of Why Haskell talk to sell them on the concepts, followed by something like the the study group you mentioned

Re: [Haskell-cafe] Logos of Other Languages

2008-12-21 Thread Paul Johnson
Paulo Tanimoto wrote: Another idea: something in the form of an Ouroboros. Is that already taken for a programming language? http://en.wikipedia.org/wiki/Ouroboros Something like this? http://www.haskell.org/sitewiki/images/f/fd/Ouroborous-oval.png Paul

[Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Paul Johnson
A call has gone out for a new logo for Haskell. Candidates (including a couple of mine) are accumulating here. There has also been a long thread on the Haskell Cafe mailing list. I've lived through a couple of corporate rebranding exercises in my time, and I've read about some others. They

Re: [Haskell-cafe] Haskell as a religion

2008-12-16 Thread Paul Johnson
Hugo Pacheco wrote: http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html What does it mean, *If* Programming Languages were religions? Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Animated line art

2008-12-06 Thread Paul Johnson
Andrew Coppin wrote: So I want some sort of sequencing primitives. Sequencing generally suggests a monad. something = do { action1; delay 10; action2} I had a go at writing what I thought the interface might look like. (Fortunately, I made no attempt to *implement* it - otherwise I would

[Haskell-cafe] Data.Map.fromListWith

2008-12-06 Thread Paul Johnson
I've just been looking at the Data.Map function fromListWith. According to the docs, it has the type: * fromListWith* :: Ord http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Ord.html#t%3AOrd k = (a - a - a) - [(k, a)] - Map

Re: [Haskell-cafe] Data.Map.fromListWith

2008-12-06 Thread Paul Johnson
Alexander Dunlap wrote: On Sat, Dec 6, 2008 at 12:22 PM, Paul Johnson [EMAIL PROTECTED] wrote: I've just been looking at the Data.Map function fromListWith. According to the docs, it has the type: * fromListWith* :: Ord http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data

[Haskell-cafe] Instances that shouldn't overlap

2008-11-26 Thread Paul Johnson
Hi, I'm trying to set up some operators for applicative versions of prelude types. For instance: -- | Applicative Equality. class (Eq a) = AppEq f a where (.==.), (./=.) :: f a - f a - f Bool instance (Applicative f, Eq a) = AppEq f a where (.==.) = liftA2 (==) (./=.) = liftA2 (/=)

Re: [Haskell-cafe] Instances that shouldn't overlap

2008-11-26 Thread Paul Johnson
Paul Johnson wrote: Hi, I'm trying to set up some operators for applicative versions of prelude types. I forgot to mention, I'm using {-# OPTIONS_GHC -fallow-undecidable-instances -XFlexibleInstances -XMultiParamTypeClasses #-} Paul

[Haskell-cafe] Re: [Haskell] Probably a trivial thing for people knowing Haskell

2008-10-19 Thread Paul Johnson
Friedrich wrote: Paul Johnson [EMAIL PROTECTED] writes: [...] Because file reading is lazy, each line is only read when it is to be processed, and then gets reaped by the garbage collector. So it all runs in constant memory. Would you mind to elaborate a bit about it. What's so

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-17 Thread Paul Johnson
Derek Elkins wrote: All you need is a T-shirt: http://www.cafepress.com/skicalc Or http://www.cafepress.com/l_revolution Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Health effects

2008-10-03 Thread Paul Johnson
Andrew Coppin wrote: Oh, no. The entire bar is 2 Kg, I wasn't actually planning to eat the whole thing! o_O My god, my pancreas would explode or something... My Dad once ate two bars of dark cooking chocolate. He said he got some odd visual distortions; flickering auras around things, and

Re: [Haskell-cafe] Haskell stacktrace

2008-09-10 Thread Paul Johnson
Pieter Laeremans wrote: Hello, I've written a cgi script in haskell, it crashes sometimes with the error message Prelude . tail : empty list Yup, been there, done that. First, look for all the uses of tail in your program and think hard about all of them. Wrap them in assert or trace

Re: [Haskell-cafe] trying to understand monad transformers....

2008-09-09 Thread Paul Johnson
Daryoush Mehrtash wrote: The MaybeT transformer is defined as: newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe a)} instance Functor http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Functor m

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-04 Thread Paul Johnson
minh thu wrote: Do you suggest I use data Thing = Thing | None and IORef Thing instead of data Thing = Thing and Maybe (IORef Thing) ? I'm writing a data structure that can hold Things (and that can be mutated) or nothing (there is a hole in the wrapping data). I'd have thought you

[Haskell-cafe] Calling Lockheed, Indra, Thales, Raytheon

2008-08-28 Thread Paul Johnson
This is a strange question, I know, but is there anyone working in any of the above companies on this mailing list? Everyone will no doubt be wondering what they have in common. I'm afraid I can't discuss that. Paul. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Calling Lockheed, Indra, Thales, Raytheon

2008-08-28 Thread Paul Johnson
Paul Johnson wrote: This is a strange question, I know, but is there anyone working in any of the above companies on this mailing list? Everyone will no doubt be wondering what they have in common. I'm afraid I can't discuss that. I will say that this is not a job search, and I'm

Re: [Haskell-cafe] Re: QuickCheck [Architecturally flawed]

2008-07-13 Thread Paul Johnson
Ryan Ingram wrote: I think you can use the duality of Writer/Reader to help you here; you have the law that, for suitable dual computations r and w, run_reader r (run_writer (w x)) == x Then you can build up a list of rules specifying which computations are dual; read64 is dual to write64, for

[Haskell-cafe] Learning GADT types to simulate dependent types

2008-06-28 Thread Paul Johnson
I'm trying to understand how to use GADT types to simulate dependent types. I'm trying to write a version of list that uses Peano numbers in the types to keep track of how many elements are in the list. Like this: {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} module Plist

Re: [Haskell-cafe] Learning GADT types to simulate dependent types

2008-06-28 Thread Paul Johnson
Daniel Fischer wrote: My Oleg rating isn't high either, and certainly you can do it more elegant, but class Concat l1 l2 l3 | l1 l2 - l3, l1 l3 - l2 where pConcat :: l1 a - l2 a - l3 a instance Concat (Plist Zero) (Plist n) (Plist n) where pConcat _ ys = ys instance Concat (Plist

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Paul Johnson
Achim Schneider wrote: There won't ever be a space leak without a time leak nor a time leak without a space leak. I'd just call it a leak. Actually I think you can have a space leak without a time leak. For instance if every time around the main loop I cons data onto a linked list that

[Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

2008-05-14 Thread Paul Johnson
We've had a big debate over mean xs = foldl' (+) 0 xs / fromIntegral (length xs) For anyone who didn't follow it, the problem is that mean needs to traverse its argument twice, so the entire list has to be held in memory. So if xs = [1..10] then mean xs uses all your memory, but

Re: [Haskell-cafe] GHC predictability

2008-05-13 Thread Paul Johnson
Jeff Polakow wrote: [...] This can be easily fixed by defining a suitable strict sum: sum' = foldl' (+) 0 and now sum' has constant space. We could try to redefine mean using sum': mean1 xs = sum' xs / fromIntegral (length xs) but this still gobbles up memory. The reason is that xs

Re: [Haskell-cafe] What's the difference?

2008-04-08 Thread Paul Johnson
PR Stanley wrote: Hi What is the difference between data T0 f a = MkT0 a instance Eq (T0 f a) where ... and data T0 f a = MkT0 a instance Eq a = Eq (T0 f a) where ... The second one says that TO f a is only an instance of Eq if a is, while the first says that TO f a

[Haskell-cafe] Announce: Decimal arithmetic package

2008-03-30 Thread Paul Johnson
I've just uploaded version 0.1.0 of a decimal arithmetic package to Hackage. Decimal numbers are stored as an Integral mantissa and a Word8 exponent, where the number stored is mantissa * 10^(-exponent). In other words the exponent is the number of decimal places stored. There are also

Re: [Haskell-cafe] Wumpus World

2008-03-26 Thread Paul Johnson
iliali16 wrote: Hi guys I have to build the wumpus world problem. I didn't start yet since this is the first time in my life I have to do something like that and I feel not confident in starting it. So I have basic idea of what prolog and haskell can do and I know a bit of Java. I am wandering

Re: [Haskell-cafe] doctest for haskell -- a good project?

2008-03-22 Thread Paul Johnson
Shaun Cutts wrote: I note that there is a unit testing framework for Haskell, but I don't see any doctest module. Might this be a good project? I once looked at doing this, but I didn't get very far. Haddock is important here because you want to include the tests as part of the documentation.

Re: [Haskell-cafe] AMQP framing layer: design help requested.

2008-03-22 Thread Paul Johnson
Dean Herington wrote: At 6:41 PM -0700 3/21/08, Adam Langley wrote: Also getter - fmap (amqpGetTable !) getWord8 getter is just fmap (amqpGetTable !) getWord8 I don't think so. Aren't there two gettings: the first to get the type byte and the second to get the item? Yes.

[Haskell-cafe] AMQP framing layer: design help requested.

2008-03-21 Thread Paul Johnson
I'm trying to implement the AMQP framing layer. This is the bottom layer of the protocol that packs and unpacks data in lazy ByteStrings. I'm using the Binary package with its Get and Put monads to do the unpacking, and that works well. But I've run into a problem and I can't find an

Re: [Haskell-cafe] Doubting Haskell

2008-03-04 Thread Paul Johnson
Alan Carter wrote: I've written up some reflections on my newbie experience together with both versions, which might be helpful to people interested in popularizing Haskell, at: http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/ Thank you for writing this. On the lack

[Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Paul Johnson
I was looking through my old copy of The Devil's DP Dictionary by Stan Kelly-Bootle, and came across the entry for Stepwise Refinement. I thought I've seen this before: this is a parody of Darcs patch theory. It included the Null patch, chains of patches, inverse patches, and pseudo-inverse

Re: [Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Paul Johnson
Miguel Mitrofanov wrote: Does it start with Any sequence of KLUDGES, not necessarily distinct or finite...? If so, it can be found in The Computer Contradictionary, by the same author, and probably illegal copy of the last book can be found in the net somewhere. Indeed. In fact I'm not even

[Haskell-cafe] Binary IEEE floating point format for AMQP

2008-02-24 Thread Paul Johnson
I'm working on an implementation of the framing layer for AMQP (www.amqp.org). I almost had 0.9 finished when I found they had released the spec for 0.10, so I have to redo quite a lot of work. Amongst the new features of 0.10 are wire formats for floating point. These are the 4 and 8 byte

[Haskell-cafe] Re: [Haskell] *** JOB OFFER *** [...]

2008-02-23 Thread Paul Johnson
Peter Verswyvelen wrote: PS: This job offer was already placed in the Haskell Café a while ago, but I was advised there to place it in the main Haskell list. I hope this is not considered as spam. I certainly don't see it as spam. One day there will be a dozen jobs for Haskell programmers

Re: [Haskell-cafe] Enterprise Haskell AMQP library initial start and would like to pass it off to someone.

2008-01-27 Thread Paul Johnson
Berlin Brown wrote: I started a AMQP library; there really isn't a lot there but at least I was able to connect to the server. Arrgh: I was hoping I would be the first to announce this. I've been working on one (on and off) for a few months now. I've got most of the translation from XML

Re: [Haskell-cafe] Enterprise Haskell AMQP library initial start and would like to pass it off to someone.

2008-01-27 Thread Paul Johnson
Don Stewart wrote: berlin.brown: I started a AMQP library; there really isn't a lot there but at least I was able to connect to the server. Here is the code and hopefully someone else can continue with the project. Thanks! Would you like this packaged up for hackage.haskell.org, so

The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Paul Johnson
Evan Laforge wrote: Java's just wordy like that. In python you'd say max(foos, key=lambda x: x.update_time). While this is true, I was also thinking of the typical audience SPJ specified: senior technical people and managers. Most of these people have heard of Python and Ruby, but see

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Paul Johnson
Tim Chevalier wrote: On 1/26/08, Paul Johnson [EMAIL PROTECTED] wrote: * Say computers are cheap but programmers are expensive whenever explaining a correctness or productivity feature. This is true only if talking to people in high-income nations. Even in low-income

Re: [Haskell-cafe] Why functional programming matters

2008-01-24 Thread Paul Johnson
Simon Peyton-Jones wrote: 1. Small examples of actual code. The goal here is (a) to convey a visceral idea of what functional programming *is*, rather than just assume the audience knows (they don't), and (b) to convey an idea of why it might be good. Here is one I came across in the last few

Re: [Haskell-cafe] Hangman game

2008-01-20 Thread Paul Johnson
Ronald Guida wrote: Hi, I'm interested in learning how to program games. Since I have to start somewhere, I decided to write a simple Hangman game. I'm wondering if anyone can look at my code and give me some feedback. Nicely written. The design reads very much like a straight translation

[Haskell-cafe] QuickCheck properties: export or not?

2008-01-14 Thread Paul Johnson
I was recently sent a patch for my Ranged Sets library which exported all the QuickCheck properties. I'd left them unexported on the grounds that they clutter up the documentation (although simplified versions are included in the documentation) and you can easily run them with the standard

Re: [Haskell-cafe] Problem with own written monad

2008-01-09 Thread Paul Johnson
Michael Roth wrote: Yes, I have done: push, pop, top, nop, count, clear, isolate and binop. All pretty easy, once I understand that Stack a b thing. Now you are ready to write your monad tutorial. This is a standard rite of passage (or should that be write a passage) for new Haskell

Re: [Haskell-cafe] Problem with own written monad

2008-01-07 Thread Paul Johnson
Miguel Mitrofanov wrote: Yes. It's simply impossible. The Stack data type can't be turned into a monad. Why not? Surely this is just a variation on the theme of a state monad? Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Trying to fix space leak

2007-12-31 Thread Paul Johnson
Ben Challenor wrote: Hi I'm learning Haskell through writing a compiler. I'm seeing huge memory use in a function which converts the dataflow graph to the form required by Data.Graph. [...] I assume the allocation is being garbage-collected pretty quickly, because a) 6,616,297,296 bytes is

Re: [Haskell-cafe] Interesting data structure

2007-12-28 Thread Paul Johnson
Tim Docker wrote: I found it worthwhile to try and visualise what's going on here. Let's say I have 4 calculations that I want to run in parallel. The first doesn't need a request; the second needs to make a single request (A1); the third needs to make two requests where the second (B2) depends

Re: [Haskell-cafe] Functions are first class values in C

2007-12-22 Thread Paul Johnson
Cristian Baboi wrote: Let me show you an example to prove it. This reminds me of arguments in the late 80s and early 90s that C could do OO programming via function pointers, so there was no need for OO languages. Paul. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Paul Johnson
Andrew Coppin wrote: Program with no particular optimisations: 0.35 seconds. Program with stream fusion [and GHC HEAD]: 0.25 seconds. Program with stream fusion and ByteString: 0.05 seconds. Surely you'd have to work pretty hard to get that kind of speed even in C. ;-) ...erm, actually no.

Re: [Haskell-cafe] A Random Question

2007-12-15 Thread Paul Johnson
Dominic Steinitz wrote: I want to say something like: instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5) but the random values are generated by my own random number generator not the standard one. Does that make sense? The reason I'm trying to do this is I am generating random

Re: [Haskell-cafe] Need help please.

2007-12-11 Thread Paul Johnson
Ryan Bloor wrote: hi I am writing a basic Parser from scratch. So far I have functions; I think you need to read http://www.cs.nott.ac.uk/~gmh/pearl.pdf Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Strings and utf-8

2007-11-27 Thread Paul Johnson
Brandon S. Allbery KF8NH wrote: However, the IO system truncates [characters] to 8 bits. I Should this be considered a bug? I presume that its because stdio.h was defined in the days of ASCII-only strings, and the functions in System.IO are defined in terms of stdio.h. But does this need to

Re: [Haskell-cafe] What is the role of $!?

2007-11-18 Thread Paul Johnson
Andrew Coppin wrote: PS. There is a technical distinction between the terms lazy and non-strict, and also the opposite terms eger and strict. I couldn't tell you what that is. As I understand it, the distinction is between the mathematical term non-strict and the implementation method of

  1   2   >