Re: [Haskell-cafe] Explaining monads

2007-08-14 Thread Lennart Augustsson
You don't normally call x::Int a computation of an Int because there's nothing that distinguishes the value of the x from what it was before you computed it. So I prefer to regard x as a value (in a domain, of course). But for x :: (Monad m) = m Int there is something else happening, so the word

Re: [Haskell-cafe] Erlang VM in Haskell

2007-08-16 Thread Lennart Augustsson
I think Haskell is the right language to nail down the semantics of Erlang and to prototype an implementation. For performance, I think Haskell is probably not the right language, because you need high performing low level code. This isn't impossible in Haskell, but the implementations are not

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-16 Thread Lennart Augustsson
But if the strings are all constant it's perfectly feasible to concatenate them at compile time. On 8/16/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Aaron Denney wrote: On 2007-08-15, Pekka Karjalainen [EMAIL PROTECTED] wrote: A little style issue here on the side, if I may. You don't need

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Lennart Augustsson
evaluation as is practically possible. And as a previous poster showed, ghc does concatenate strings. On 8/17/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Lennart Augustsson wrote: On 8/16/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: 'Course not. The (++) function like all Haskell functions is only

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-17 Thread Lennart Augustsson
On 8/17/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Lennart Augustsson wrote: And as a previous poster showed, ghc does concatenate strings. And Haskell (as in the current language definition) does not. I was talking about Haskell. Haskell says nothing about compile time or run time

Re: [Haskell-cafe] Hints for Euler Problem 11

2007-08-18 Thread Lennart Augustsson
I agree. Computation on the type level does not imply computation on the value level. On 8/18/07, Tim Chevalier [EMAIL PROTECTED] wrote: On 8/17/07, Kim-Ee Yeoh [EMAIL PROTECTED] wrote: Incidentally, GHC's type checker is Turing complete. You already have as much static evaluation as is

Re: [Haskell-cafe] How do I simulate dependent types using phantom types?

2007-08-18 Thread Lennart Augustsson
Use value :: a - Integer On 8/18/07, DavidA [EMAIL PROTECTED] wrote: Hi, I am trying to implement quadratic fields Q(sqrt d). These are numbers of the form a + b sqrt d, where a and b are rationals, and d is an integer. In an earlier attempt, I tried data QF = QF Integer Rational

Re: [Haskell-cafe] Yet another stupid question about numeric conversion

2007-08-21 Thread Lennart Augustsson
How can you hope to convert an arbitrary Num to a Float? Num contains things like complex numbers that don't have any reasonable translation to a Float. But anyway, realToFrac is a good conversion function. -- Lennart On 8/21/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: Does a general

Re: [Haskell-cafe] Extending the idea of a general Num to other types?

2007-09-02 Thread Lennart Augustsson
You're right. The list syntax is only for lists in Haskell. It would be nice if the list syntax was overloaded too. You can overload numeric literals (by defining fromInteger) and string literals (by defining fromString, in 6.7). BTW, the [1..10] syntax is overloaded, you need an Enum instance.

Re: [Haskell-cafe] Learn Prolog...

2007-09-06 Thread Lennart Augustsson
Because you can play very clever tricks with DFS to make it efficient, time and space. On 9/5/07, Stefan O'Rear [EMAIL PROTECTED] wrote: On Wed, Sep 05, 2007 at 01:21:52PM +1000, Thomas Conway wrote: but to interpret this as a *program* you have to consider how it will be executed. In

Re: [Haskell-cafe] Composition Operator

2007-09-22 Thread Lennart Augustsson
I'm not sure what you mean by abstract function. It's a function like any other function. But otherwise you're right. :) -- Lennart On 9/22/07, PR Stanley [EMAIL PROTECTED] wrote: Ah, I understand now. Let me get this right: The resulting (a - c) is a kind of abstract function formed by

Re: [Haskell-cafe] are some of these reverse algos better than others? is there a quick and dirty way to reveal this fact?

2007-09-23 Thread Lennart Augustsson
If we're discussing bad versions of reverse, don't forget this one: rev [] = [] rev (x:xs) = case rev xs of [] - [x] y:ys - y : rev (x : rev ys) It's different from most versions of reverse because it doesn't use any auxiliarry functions. It's also extremely inefficient. --

Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-23 Thread Lennart Augustsson
I agree. This situation is totally detectable. On 9/23/07, Neil Mitchell [EMAIL PROTECTED] wrote: Hi I'm not sure, but since it would require the detection of an evaluation that does not terminate, it comes down to the halting problem, which is not generally solvable. Maybe the experts

Re: Re[2]: [Haskell-cafe] what is f=f (not) doing ?

2007-09-23 Thread Lennart Augustsson
But this was a very particular case when a thread starts evaluating a node and then comes back to the same node again. The general case is (of course) undecidable. On 9/23/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Lennart, Sunday, September 23, 2007, 2:05:46 PM, you wrote: i bet

Re: [Haskell-cafe] are some of these reverse algos better than others? is there a quick and dirty way to reveal this fact?

2007-09-23 Thread Lennart Augustsson
Well, my goal when I first wrote it was to see if I could write reverse without calling any other functions. I did realize that it was really bad. :) -- Lennart On 9/23/07, Felipe Almeida Lessa [EMAIL PROTECTED] wrote: On 9/23/07, Lennart Augustsson [EMAIL PROTECTED] wrote: If we're

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Lennart Augustsson
Since natural numbers are trivial to implement (inefficiently) I took 15 minutes and added them to my numbers package in Hackage. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numbers-2007.9.24 -- Lennart On 9/24/07, Andrew Coppin [EMAIL PROTECTED] wrote: Neil Mitchell wrote:

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Lennart Augustsson
PS. Prelude Data.List Data.Number.Natural genericLength [1..] (10 :: Natural) True On 9/24/07, Lennart Augustsson [EMAIL PROTECTED] wrote: Since natural numbers are trivial to implement (inefficiently) I took 15 minutes and added them to my numbers package in Hackage. http

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Lennart Augustsson
It's reasonably easy to read. But you could make it more readable. Type signatures, naming the first lambda... On 9/25/07, Andrew Coppin [EMAIL PROTECTED] wrote: While using Haskell, I often find myself writing convoluted constructions such as this: show_system = unlines . zipWith

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Lennart Augustsson
Text.printf only has one type. But it is a bit involved. Just use it without worrying exactly how it works. :) Like 's ++ printtf %g*x%d x i' On 9/25/07, Andrew Coppin [EMAIL PROTECTED] wrote: Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: printf don't always perform

Re: [Haskell-cafe] unsafePerformIO: are we safe?

2007-09-26 Thread Lennart Augustsson
Things can go arbitrarily wrong if you misuse unsafePerformIO, you can even subvert the type system. On 9/26/07, Jorge Marques Pelizzoni [EMAIL PROTECTED] wrote: Hi, all! This is a newbie question: I sort of understand what unsafePerformIO does but I don't quite get its consequences. In

Re: [Haskell-cafe] unsafePerformIO: are we safe?

2007-09-26 Thread Lennart Augustsson
You could do this: r :: IORef [a] r = unsafePerformIO $ newIORef [] cast :: a - b cast a = unsafePerformIO $ do writeIORef r [a] x - readIORef r return $ head x On 9/26/07, Dan Piponi [EMAIL PROTECTED] wrote: On 9/26/07, Lennart Augustsson [EMAIL PROTECTED] wrote: Things can go

Re: [Haskell-cafe] Type-level arithmetic

2007-10-06 Thread Lennart Augustsson
Yes, that web page is a terrible introduction to dependent types. :) On 10/6/07, Andrew Coppin [EMAIL PROTECTED] wrote: Dan Piponi wrote: On 10/6/07, Andrew Coppin [EMAIL PROTECTED] wrote: I've seen quite a few people do crazy things to abuse the Haskell type system in order to perform

Re: [Haskell-cafe] Re: pi

2007-10-10 Thread Lennart Augustsson
Come on people! This discussion is absurd. The numeric classes in Haskell have a lot of choices that are somewhat arbitrary. Just live with it. If pi has a default or not has no practical consequences. -- Lennart ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-14 Thread Lennart Augustsson
The Mersenne twister should be able to split better than most. but I'm not sure how efficient it is. On 10/14/07, Isaac Dupree [EMAIL PROTECTED] wrote: Don Stewart wrote: I've seen similar results switching to the SIMD mersenne twister C implementation for randoms:

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Lennart Augustsson
You don't need to unsubscribe. Just avoid posting things that are totally wrong (at least without a warning). -- Lennart On 10/14/07, Andrew Coppin [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I will be impolite. If this were the first posting of A.C., I would suspect that he is

Re: [Haskell-cafe] haskell-curry, classical logic, excluded middle

2007-10-14 Thread Lennart Augustsson
You realize that Djinn can write all that code for you? :) Well, not with your encoding of Not, but with a similar one. -- Lennart On 10/14/07, Tim Newsham [EMAIL PROTECTED] wrote: I've been struggling with this for the last day and a half. I'm trying to get some exercise with the type

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-15 Thread Lennart Augustsson
And Haskell embedded a logical programming language on accident. On 10/15/07, Manuel M T Chakravarty [EMAIL PROTECTED] wrote: Dan Piponi wrote, On 10/12/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: He wants to write entire programs in the type system, something like the crazies

Re: [Haskell-cafe] Strange subtract operator behavior

2007-10-16 Thread Lennart Augustsson
If naturals have a perfectly reasonable subtraction then they also have a perfectly reasonable negate; the default is 0-x. (Oh, subtraction wasn't THAT reasonable, you say. :) ) -- Lennart On 10/17/07, John Meacham [EMAIL PROTECTED] wrote: On Tue, Oct 16, 2007 at 06:27:19PM -0300, Isaac

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-17 Thread Lennart Augustsson
Check Wikipedia. Peirce law, law of excluded middle, double negation, ... they are all equivalent and it can be instructive to see how one can derive one from the other. On 10/17/07, Tim Newsham [EMAIL PROTECTED] wrote: Very clear tutorial indeed. But why isn't propCC shown as Pierce's Law?

Re: [Haskell-cafe] Strange subtract operator behavior - and lazy naturals

2007-10-17 Thread Lennart Augustsson
The one in the numbers package is not quite as clever as John's; it's the naïve version of lazy naturals. On 10/17/07, Stuart Cook [EMAIL PROTECTED] wrote: On 10/17/07, John Meacham [EMAIL PROTECTED] wrote: if anyone is interested, Although I bet this has been implemented a hundred times

Re: [Haskell-cafe] How much of Haskell was possible 20 years ago?

2007-10-21 Thread Lennart Augustsson
All of Haskell was possible 20 years ago. The LML compiler (written in LML) compiled a language similar to Haskell, the only real differences is syntax and the type system (and monadic IO wasn't invented yet). It was a bit slow to recompile itself, but not bad. A 16MHz 386 and 8M of memory

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-21 Thread Lennart Augustsson
There's nothing wrong with Haskell types. It's the terms that make Haskell types an inconsistent logic. But that doesn't mean that the C-H correspondence doesn't have any insight to offer. -- Lennart On 10/21/07, Derek Elkins [EMAIL PROTECTED] wrote: On Wed, 2007-10-17 at 15:06 -0700, Dan

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-10-31 Thread Lennart Augustsson
There are many ways to implement currying. And even with GHC you can get it to do some work given one argument if you write the function the right way. I've used this in some code where it was crucial. But yeah, a code generator at run time is a very cool idea, and one that has been studied, but

Re: Re[2]: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-11-01 Thread Lennart Augustsson
Yes, of course. But they don't do partial evaluation. On 11/1/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Lennart, Thursday, November 1, 2007, 2:45:49 AM, you wrote: But yeah, a code generator at run time is a very cool idea, and one that has been studied, but not enough.

Re: [Haskell-cafe] Fibbonachi numbers algorithm work TOO slow.

2007-11-07 Thread Lennart Augustsson
When discussing the complexity of fib don't forget that integer operations for bignums are no longer constant time. -- Lennart On Nov 7, 2007 6:55 AM, Henning Thielemann [EMAIL PROTECTED] wrote: On Tue, 6 Nov 2007 [EMAIL PROTECTED] wrote: However, this is still an O(log n) algorithm,

Re: [Haskell-cafe] Somewhat random history question

2007-11-11 Thread Lennart Augustsson
It's interesting that the article completely fails to mention hbc which I know they used during the GHC bootstrap. Oh well. :) On Nov 11, 2007 2:41 PM, Richard Kelsall [EMAIL PROTECTED] wrote: Andrew Coppin wrote: ...if GHC is written in Haskell, how the heck did they compile GHC in the

Re: [Haskell-cafe] Somewhat random history question

2007-11-12 Thread Lennart Augustsson
No worries. I read the History of Haskell paper twice, but not the final version, I guess. As far as I remember you started the bootstrapping with the ghc built on the LML compiler. But as hbc became available it was soon more reliable and produced better code, so you switched to that until the

Re: [Haskell-cafe] let vs. where

2007-11-15 Thread Lennart Augustsson
No, Haskell functions take exactly one argument. On Nov 14, 2007 1:05 AM, Robin Green [EMAIL PROTECTED] wrote: On Tue, 13 Nov 2007 13:51:13 -0800 Dan Piponi [EMAIL PROTECTED] wrote: Up until yesterday I had presumed that guards only applied to functions. But I was poking about in the

Re: [Haskell-cafe] Tetris

2007-11-20 Thread Lennart Augustsson
I implemented Tetris in LML long before Haskell existed. It was text based, but looked good with a custom font. :) Haskell has no problem with state, it's just explicit. -- Lennart On Nov 19, 2007 9:25 PM, Andrew Coppin [EMAIL PROTECTED] wrote: If you were going to implement Tetris in

[Haskell-cafe] Re: [Haskell] recursive deriving

2007-11-21 Thread Lennart Augustsson
This seems very, very wrong. The missing instance(s) might be left out because of some good reason (e.g. if you have implemented sets with list and not provided Ord). On Nov 21, 2007 12:59 AM, Duncan Coutts [EMAIL PROTECTED] wrote: On Tue, 2007-11-20 at 19:18 -0500, Alex Jacobson wrote: When

Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Lennart Augustsson
IMHO, no one in the right mind uses Windows voluntarily. :) I'm forced to use it at work, and it's a pain. But since many are forced to use Windows it would be nice if ghc was as well supported on Windows and Unix. On Nov 22, 2007 12:11 AM, Aaron Denney [EMAIL PROTECTED] wrote: On 2007-11-21,

Re: [Haskell-cafe] About garbage collecting

2007-11-27 Thread Lennart Augustsson
This is an idea that has been kicking around for a long time. But no Haskell implementation that I know of implements it. On Nov 27, 2007 3:43 PM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, If available memory is low, is the garbage collector going to eliminate data that is still referenced,

Re: [Haskell-cafe] Why aren't Float and Double Bounded?

2007-11-27 Thread Lennart Augustsson
But IEEE can be run with projective infinity in which case there is only one of them. On Nov 27, 2007 7:41 PM, Isaac Dupree [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 26 Nov 2007, Jason Dusek wrote: Among numeric types, it seems that only integer types are Bounded.

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-04 Thread Lennart Augustsson
I don't even understand what your notation means. But apart from that, there are good reasons to define strictness denotationally instead of operationally. Remember that _|_ is not only exceptions, but also non-termination. For instance, the following function is strict without using its

Re: [Haskell-cafe] IO is a bad example for Monads [was: do]

2007-12-08 Thread Lennart Augustsson
I agree with Dan here. IO is important because you can't write any real program without using it. So why not teach enough of it to get people off the ground straight away? People who hang around long enough to do some more Haskell programming will run into the other monads sooner or later. But

Re: [Haskell-cafe] a Char-Char function?

2007-12-08 Thread Lennart Augustsson
0x02 is not a Char, it's a numeric constant. Perhaps you meant '\x02' ? On Dec 8, 2007 9:02 AM, Galchin Vasili [EMAIL PROTECTED] wrote: Hello, I am writing a function(actually much more than this): bozo :: Char - Char bozo 0x02 = 'a' ... However, I get complaints from ghc

Re: [Haskell-cafe] ARM back end?

2007-12-09 Thread Lennart Augustsson
There's an ARM backend in hbc. On Nov 2, 2007 8:30 PM, Greg Fitzgerald [EMAIL PROTECTED] wrote: Anybody know of an ARM back end for any of the Haskell compilers? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] IO is a bad example for Monads [was: do]

2007-12-09 Thread Lennart Augustsson
in a functional language, you can. For instance, write real, interactive programs in FRP, phooey, or TV. And if you do, you'll get semantic simplicity, powerful simpler reasoning, safety and composability. - Conal On Dec 8, 2007 1:26 AM, Lennart Augustsson [EMAIL PROTECTED] wrote: I agree

Re: [Haskell-cafe] Re: [Haskell] IVars

2007-12-09 Thread Lennart Augustsson
I would claim that it's fine to use the type readIVar :: IVar a - a if you're willing to give the right semantics to newIVar :: IO (IVar a) The semantics is that sometimes when you create an IVar you'll get one that always returns _|_ when read, sometimes you'll get a proper one. Now if you

Re: [Haskell-cafe] Do real programs need IO? (was IO is a bad example for Monads)

2007-12-09 Thread Lennart Augustsson
, phooey, or TV. And if you do, you'll get semantic simplicity, powerful simpler reasoning, safety and composability. - Conal On Dec 8, 2007 1:26 AM, Lennart Augustsson [EMAIL PROTECTED] wrote: [...] IO is important because you can't write any real program without

Re: [Haskell-cafe] IO is a bad example for Monads [was: do]

2007-12-09 Thread Lennart Augustsson
write *any* real program without using IO? Cheers, - Conal On Dec 9, 2007 12:02 PM, Lennart Augustsson [EMAIL PROTECTED] wrote: Conal, It's true that you can avoid using IO (except for a wrapper) for certain kinds of programs. For instance, if all you want is a String-String function

Re: [Haskell-cafe] Do real programs need IO? (was IO is a bad example for Monads)

2007-12-09 Thread Lennart Augustsson
get semantic simplicity, powerful simpler reasoning, safety and composability. - Conal On Dec 8, 2007 1:26 AM, Lennart Augustsson [EMAIL PROTECTED] wrote: [...] IO is important because you can't write any real program without using it. So why

Re: [Haskell-cafe] IO is a bad example for Monads

2007-12-10 Thread Lennart Augustsson
If Haskell wants yo significantly widen it's audience then the tutorials have to cater for the impatient. Perhaps it's better to remain a fringe language. I truly don't know. -- Lennart On Dec 10, 2007 7:00 PM, Henning Thielemann [EMAIL PROTECTED] wrote: On Mon, 10 Dec 2007, Dan Piponi

Re: [Haskell-cafe] IO is a bad example for Monads

2007-12-11 Thread Lennart Augustsson
And more power to those who are pursuing the vision! But in the mean time I need to read and write files, start up external programs, call Excel through FFI, etc, etc. And there's no clever API for that yet, only IO. And I'd rather do IO in Haskell than in C++. I share the vision, though. I'm

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Lennart Augustsson
Not can, should. And it might even survive in th world of Unicode. On Dec 12, 2007 4:17 PM, Brent Yorgey [EMAIL PROTECTED] wrote: On Dec 12, 2007 10:36 AM, Arie Groeneveld [EMAIL PROTECTED] wrote: Reinier Lamers schreef: printint :: Int - [Char] printint = map chr . map (+0x30) .

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Lennart Augustsson
I had it pretty well worked out for single parameter type classes, but I couldn't see any nice extension to multiple parameters. On Dec 11, 2007 5:30 PM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: | If it really would work ok we should get it fully specified and | implemented so we can fix

Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
? --- Forwarded message --- From: Cristian Baboi [EMAIL PROTECTED] To: Lennart Augustsson [EMAIL PROTECTED] Cc: haskell-cafe@haskell.org haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Wikipedia on first-class object Date: Thu, 27 Dec 2007 16:08:58 +0200 On Thu, 27 Dec 2007 14:02:36 +0200

Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
One value. One infinite value. On Dec 27, 2007 3:53 PM, Cristian Baboi [EMAIL PROTECTED] wrote: On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson [EMAIL PROTECTED] wrote: Absolutly. Every expression in Haskell denotes a value. Now, we've not agreed what value means, but to me

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Lennart Augustsson
There's no (valid) formalism that says that [n..]==[n..] is True. The formalism says that [n..] and [n..] are equal. But being equal does not mean that the Haskell (==) function returns True. The (==) function is just an approximation of semantic equality (by necessity). -- Lennart On Dec 28,

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Lennart Augustsson
You are right, Portable Haskell Dynamic libraries do not exist because the Haskell standard does not talk about them at all. Portable C Dynamic libraries do not exist either. Given POSIX they exist, but if you happen upon a platform that only has a C compiler it won't have them. On Dec 28, 2007

Re: [Haskell-cafe] Re: Sending bottom to his room

2007-12-29 Thread Lennart Augustsson
id is well defined and there is only one of them. On Dec 29, 2007 3:13 PM, Cristian Baboi [EMAIL PROTECTED] wrote: On Sat, 29 Dec 2007 16:01:51 +0200, Achim Schneider [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] wrote: It appears as if lambda calculus is defined by lambda

Re: [Haskell-cafe] Re: Displaying # of reductions after eachcomputation in ghci?

2008-01-09 Thread Lennart Augustsson
What is a reduction anyway? On Jan 8, 2008 2:48 PM, Fernando Rodriguez [EMAIL PROTECTED] wrote: Hello Stefan O'Rear, No. (rambling explanation snipped awaiting further request) Stefan OK, I'll take the bait: why not? ___

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-10 Thread Lennart Augustsson
Some people seem to think that == is an equality predicate. This is a big source of confusion for them; until they realize that == is just another function returning Bool they will make claims like [1..]==[1..] having an unnatural result. The == function is only vaguely related to the equality

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-10 Thread Lennart Augustsson
Thank you Duncan, you took the words out of my mouth. :) On Jan 10, 2008 5:42 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Fri, 2008-01-11 at 01:12 +0100, Achim Schneider wrote: Tillmann Rendel [EMAIL PROTECTED] wrote: Achim Schneider wrote: [1..] == [1..] [some discussion

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-11 Thread Lennart Augustsson
That would give you a language with a semantics I don't want to touch. Sometimes useful, yes, but far to intensional for my taste. -- Lennart On Jan 11, 2008 5:59 AM, Achim Schneider [EMAIL PROTECTED] wrote: Yes, thanks. I actually do think that many things would be easier if every

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-11 Thread Lennart Augustsson
that you might think exist for numbers. -- Lennart On Jan 11, 2008 1:27 AM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Freitag, 11. Januar 2008 08:11 schrieb Lennart Augustsson: Some people seem to think that == is an equality predicate. This is a big source of confusion for them; until

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-11 Thread Lennart Augustsson
If you can't stomach the weirdness of floating point then perhaps you should try to define your own type that obeys all the expected laws? :) On Jan 11, 2008 3:36 AM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Freitag, 11. Januar 2008 11:03 schrieb Felipe Lessa: Another thing for the

Re: [Haskell-cafe] Re: 0/0 1 == False

2008-01-11 Thread Lennart Augustsson
Also, there are only two zeros, +0 and -0 and they compare equal. On Jan 11, 2008 10:12 AM, Achim Schneider [EMAIL PROTECTED] wrote: I was wrong in claiming that But then there's +0/0 and -0/0, which would be +Infinity and -Infinity, and +0 0 -0. AFAIK there are no floats with three

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-14 Thread Lennart Augustsson
There is no technical reason for this. It's a matter of taste. As someone else pointed out, different arities is usually a bug. -- Lennart On Jan 13, 2008 3:12 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub But

Re: [Haskell-cafe] Bytestrings and [Char]

2010-03-22 Thread Lennart Augustsson
Turn on OverloadedStrings and you can pattern match on any type you like that is in the IsString class. Which means that Data.Text can use string literals just like regular strings (but you can't use Char literals in the match). On Mon, Mar 22, 2010 at 1:15 PM, Ivan Miljenovic

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Lennart Augustsson
It's important to switch from mod to rem. This can be done by a simple abstract interpretation. I'm nore sure if it's jhc or gcc that does this for jhc. -- Lennart On Sat, Mar 27, 2010 at 10:30 PM, Rafael Cunha de Almeida almeida...@gmail.com wrote: John Meacham wrote: Here are jhc's

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-28 Thread Lennart Augustsson
Does anything change if you swap the first two rhss? On Sun, Mar 28, 2010 at 1:28 AM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 28/03/2010, at 09:47, Lennart Augustsson wrote: It's important to switch from mod to rem.  This can be done by a simple abstract interpretation. Also

Re: [Haskell-cafe] Where are the haskell elders?

2010-03-29 Thread Lennart Augustsson
What Don said. 2010/3/29 Don Stewart d...@galois.com: gue.schmidt: Hi all, I notice that posts from the Haskell elders are pretty rare now. Only every now and then we hear from them. How come? Because there is too much noise on this list, Günther -- Don

Re: [Haskell-cafe] Re: ANN: data-category, restricted categories

2010-03-30 Thread Lennart Augustsson
Of course Haskell' should have an empty case. As soon as empty data declarations are allowed then empty case must be allowed just by using common sense. On Tue, Mar 30, 2010 at 11:03 PM, Ashley Yakeley ash...@semantic.org wrote: wagne...@seas.upenn.edu wrote: I believe I was claiming that, in

Re: [Haskell-cafe] Integers v ints

2010-04-03 Thread Lennart Augustsson
The cost factor of Integer vs Int is far, far smaller than the factor between computable reals vs Double. On Thu, Apr 1, 2010 at 6:33 PM, Jens Blanck jens.bla...@gmail.com wrote: Yes, the cost for computable reals will be an order of magnitude or possibly two for well-behaved computations. For

Re: [Haskell-cafe] ShowList magic

2010-05-17 Thread Lennart Augustsson
Your question is actually deeper than some of the people answering you seem to realize. How does ghci decide what to do when you say show [] ? The expression [] has type [a], which means it could be a list of any type 'a', including Char. Normally, when Haskell can't determine the type in this

Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-23 Thread Lennart Augustsson
For Bool, I'm not sure, but for, e.g., () it's certainly true. Take this definition of == () == _ = True Using case analysis of just the constructors, ignoring the value bottom, you can easily prove symmetry. But '() == undefined' terminates, whereas 'undefined == ()' does not. Ignore bottom

Re: [Haskell-cafe] Clean proof?

2010-05-23 Thread Lennart Augustsson
There is no clean proof of that statement because it is false. (Consider the argument 'undefined'.) 2010/5/23 R J rj248...@hotmail.com: Given the following definition of either, from the prelude:     either                      :: (a - c, b - c) - Either a b - c     either (f, g) (Left x)      

Re: [Haskell-cafe] Clean proof -- correction

2010-05-23 Thread Lennart Augustsson
Actually, I didn't notice the typo. It's still not a true statement. (h . either (f, g)) undefined /= (either (h . f, h . g)) undefined Also, it's not exactly the function either from the Prelude. -- Lennart 2010/5/23 R J rj248...@hotmail.com: Correction:  the theorem is     h . either

Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Lennart Augustsson
That's totally false. You don't evaluate 'undefined' before calling 'id'. (Or if you, it's because you've made a transformation that is valid because 'id' is strict.) On Mon, May 24, 2010 at 9:05 AM, Alexander Solla a...@2piix.com wrote: Yes, but only because it doesn't work at all.  Consider

Re: [Haskell-cafe] currying combinators

2010-05-26 Thread Lennart Augustsson
There are no interesting (i.e. total) functions of that type. 2010/5/25 Yitzchak Gale g...@sefer.org: Günther Schmidt wrote: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25694 in which I attempt to develop a currying combinator library. I'm stuck at some point and would appreciate any

Re: [Haskell-cafe] currying combinators

2010-05-27 Thread Lennart Augustsson
So what would you consider a proof that there are no total Haskell functions of that type? Or, using Curry-Howard, a proof that the corresponding logical formula is unprovable in intuitionistic logic? As I understand, in general this can only be proven using meta theory rather than the logic

Re: [Haskell-cafe] currying combinators

2010-05-28 Thread Lennart Augustsson
just consider cut free proofs there's usually infinitely many.) On Fri, May 28, 2010 at 8:14 AM, wren ng thornton w...@freegeek.org wrote: Lennart Augustsson wrote: So what would you consider a proof that there are no total Haskell functions of that type? Or, using Curry-Howard, a proof

Re: [Haskell-cafe] Using the ContT monads for early exits of IO ?

2010-06-10 Thread Lennart Augustsson
I would not use the continuation monad just for early exit. Sounds like the error monad to me. 2010/6/10 Günther Schmidt gue.schm...@web.de: Hi everyone, I'm about to write a rather lengthy piece of IO code. Depending on the results of some of the IO actions I'd like the computation to stop

Re: [Haskell-cafe] Instances for Set of Functor, Traversable?

2010-07-26 Thread Lennart Augustsson
Try to make Set an instance of Functor and you'll see why it isn't. It's very annoying. On Mon, Jul 26, 2010 at 11:55 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: Is there a specific reason why Set doesn't have instances for Functor and Traversable?  Or have they just not been

Re: [Haskell-cafe] Re: Instances for Set of Functor, Traversable?

2010-07-27 Thread Lennart Augustsson
, www.cs.kuleuven.be/~toms/Research/papers/constraint_families.pdf On Tue, Jul 27, 2010 at 10:17 AM, o...@okmij.org wrote: Lennart Augustsson wrote: Try to make Set an instance of Functor and you'll see why it isn't. It's very annoying. And yet the very simple, and old solution works.        http

Re: [Haskell-cafe] Combinations

2006-06-06 Thread Lennart Augustsson
Sounds like cartesian product to me. So you could try combinations [] = [[]] combinations (xs:xss) = liftM2 (:) xs (combinations xss) -- Lennart [EMAIL PROTECTED] wrote: Hi, I need a functions which takes as argument a list of lists like this one: [[1,2],[3],[4]] and gives me a list

Re: [Haskell-cafe] Unix gurus, help me please

2006-07-17 Thread Lennart Augustsson
On Jul 17, 2006, at 10:04 , Bulat Ziganshin wrote: #!/usr/bin/env runhaskell instead of #!/usr/bin/runhaskell at the start of Setup.hs file. Is that really better? Yes, much better. I think it's crazy to have runhaskell installed in /usr/bin. It should be somewhere in your path, but

Re: [Haskell-cafe] Why shouldn't variable names be capitalized?

2006-08-04 Thread Lennart Augustsson
There are two places where confusion could arise if you didn't have the case distinction in Haskell: pattern matching (does a name refer to a constructor or not) and type expressions (is it a type variable or not). In Haskell the distinction is made by case, but this is far from the only

Re: [Haskell-cafe] A restricted subset of CPP included in a revision of Haskell 98

2006-08-17 Thread Lennart Augustsson
Even though I'm largely responsible for making CPP available in a Haskell compiler I think it's an abomination. It should be avoided. If we standardize it, people will use it even more. I think we should discourage it instead, then looking at exactly what it's used for and supplying sane

Re: [Haskell-cafe] A restricted subset of CPP included in a revisionof Haskell 98

2006-08-17 Thread Lennart Augustsson
On Aug 17, 2006, at 17:11 , Brian Hulley wrote: On Thursday, August 17, 2006 7:54 PM, Brian Smith wrote: I want to have conditionals limited in their placement to make things easier for refactoring tools. But, I don't have any ideas about how to deal with conditional exports without

Re: [Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Lennart Augustsson
On Aug 19, 2006, at 05:14 , Henk-Jan van Tuyl wrote: [...] *Iteration fromtoby 12 42 3 (flip (**) 0.33) fromtoby 12 42 3 (**0.33) And why approximate so much? fromtoby 12 42 3 (** (1/3)) ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-19 Thread Lennart Augustsson
things that are more tedious to write as primatives in other languages.. The only other language that was as easy to get to this stage with was scheme. Sorry for the ramble, gene On 8/19/06, Lennart Augustsson [EMAIL PROTECTED] wrote: On Aug 19, 2006, at 05:14 , Henk-Jan van Tuyl wrote

Re: [Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

2006-08-21 Thread Lennart Augustsson
to equal equal_ = error Not enough operands on stack -- Lennart On Aug 21, 2006, at 04:42 , Gene A wrote: Lennart and all, On 8/19/06, Lennart Augustsson [EMAIL PROTECTED] wrote: There are much better ways than storing strings on the stack. Like using a data type

Re: [Haskell-cafe] monads once again: a newbie perspective

2006-08-26 Thread Lennart Augustsson
I like sigfpe's introduction to monads: http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads- and.html -- Lennart On Aug 26, 2006, at 14:04 , Andrea Rossato wrote: Il Fri, Aug 25, 2006 at 01:13:58PM -0400, Cale Gibbard ebbe a scrivere: Hey cool, a new monad tutorial!

Re: [Haskell-cafe] haskell - fpga

2006-08-30 Thread Lennart Augustsson
General Haskell constructs map really poorly to FPGAs. You could define a subset that maps nicely, though. But as far as I know noone has made such a compiler. It's a rather big undertaking. You could look at Cryptol and Bluespec, they are languages with similarities to Haskell better

Re: [Haskell-cafe] Re: Re: A free monad theorem?

2006-09-03 Thread Lennart Augustsson
Well, bind is extracting an 'a'. I clearly see a '\ a - ...'; it getting an 'a' so it can give that to g. Granted, the extraction is very convoluted, but it's there. -- Lennart On Sep 2, 2006, at 19:44 , Udo Stenzel wrote: Benjamin Franksen wrote: Sure. Your definition of bind

Re: [Haskell-cafe] Re: Re: A free monad theorem?

2006-09-03 Thread Lennart Augustsson
that extraction, and that's fine by me. :) -- Lennart On Sep 3, 2006, at 12:32 , Daniel Fischer wrote: Am Sonntag, 3. September 2006 15:39 schrieb Lennart Augustsson: Well, bind is extracting an 'a'. I clearly see a '\ a - ...'; it getting an 'a' so it can give that to g. Granted

Re: [Haskell-cafe] A free monad theorem?

2006-09-04 Thread Lennart Augustsson
Sonntag, 3. September 2006 15:39 schrieb Lennart Augustsson: Well, bind is extracting an 'a'. I clearly see a '\ a - ...'; it getting an 'a' so it can give that to g. Granted, the extraction is very convoluted, but it's there. -- Lennart But instance Monad (Cont r) where return

Re: Quantification in free theorems (Was: [Haskell-cafe] Exercise in point free-style)

2006-09-04 Thread Lennart Augustsson
I'd like to see a mix of the two systems. Top level quantifiers should be optional; they often don't improve readability. -- Lennart On Sep 4, 2006, at 04:21 , Janis Voigtlaender wrote: [EMAIL PROTECTED] wrote: G'day all. Quoting Donald Bruce Stewart [EMAIL PROTECTED]: Get some

  1   2   3   4   5   6   >