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

2007-09-05 Thread Simon Peyton-Jones
| On that note, I've been finding GHC's type suggestions often worse | than useless, and wish it wouldn't even bother to try -- even more | confusing for new users to have the compiler suggest pointless things | like declaring an instance of Num String or whatever. I'd prefer it | if it could just

Re: [Haskell-cafe] About mplus

2007-09-05 Thread Henning Thielemann
On Wed, 5 Sep 2007, ok wrote: On 5 Sep 2007, at 6:16 pm, Henning Thielemann wrote: I think it is very sensible to define the generalized function in terms of the specific one, not vice versa. The specific point at issue is that I would rather use ++ than `mplus`. In every case where both a

Re: [Haskell-cafe] About mplus

2007-09-05 Thread Jules Bean
David Benbennick wrote: You mean (++) = mplus. I've wondered that too. Similarly, one should define map = fmap. And a lot of standard list functions can be generalized to MonadPlus, for example you can define filter :: (MonadPlus m) => (a -> Bool) -> m a -> m a Somehow this filter fails my

Re: [Haskell-cafe] About mplus

2007-09-05 Thread Jules Bean
ok wrote: On 5 Sep 2007, at 6:16 pm, Henning Thielemann wrote: I think it is very sensible to define the generalized function in terms of the specific one, not vice versa. The specific point at issue is that I would rather use ++ than `mplus`. In every case where both are defined, they agree,

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

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 08:19 +0100, Simon Peyton-Jones wrote: > | confusing for new users to have the compiler suggest pointless things > | like declaring an instance of Num String or whatever. This also gets my vote for the "Error-message-most-likely-to-be-unhelpful"-award. IME, this often aris

[Haskell-cafe] Re: [Haskell] ANNOUNCE: xmonad 0.3

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 13:02 +1000, Donald Bruce Stewart wrote: > The xmonad dev team is pleased to announce the 0.3 release of xmonad. I just wanted to congratulate the team, and say that xmonad is, along with darcs, my favorite "mainstream" Haskell program. I used to spend days experimenting w

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

2007-09-05 Thread Simon Peyton-Jones
| > when you come across a case where GHC produces an | > unhelpful message, send it in, along with the program | > that produced it, | | Contents of test/error.hs: | f x s = x + show s | | Error message from GHCi: | test/error.hs:2:8: | No instance for (Num

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

2007-09-05 Thread Peter Verswyvelen
IMHO error reporting should be done in a hierarchical manner, so that you get a very brief description first, followed by many possible hints for fixing it, and each hint could have subhints etc... Now to make this easy to read, it should be integrated into some IDE of course, otherwise it woul

Re: [Haskell-cafe] ANNOUNCE: xmonad 0.3

2007-09-05 Thread Peter Verswyvelen
Looks really nice, but if I understand it correctly it is specific for X, so does not work on Windows? If so, would it be possible to integrate this into GTK2HS so it works as a docking manager inside an application? ___ Haskell-Cafe mailing l

[Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-05 Thread Jon Fairbairn
Sterling Clover <[EMAIL PROTECTED]> writes: > of course you could rewrite this in a while loop too > although you'd have to use an assignment, but at least > still not one with a silly "done" variable. People seem to have overlooked the bit of Algol68 I posted, so I'll repeat it While If E

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-05 Thread Ketil Malde
> WARNING: Learning Haskell is dangerous to your health! :-) I liked that so much I made a hazard image to go with it. http://malde.org/~ketil/Hazard_lambda.svg -k ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailma

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

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 09:56 +0100, Simon Peyton-Jones wrote: > Is your suggestion specific to String? No. > then I really might have intended to use Complex as a Num type IME this is much rarer, and I think if a newbie is told that Complex is not (but needs to be) and instance of Num, it is re

[Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Simon Marlow
Ketil Malde wrote: WARNING: Learning Haskell is dangerous to your health! :-) I liked that so much I made a hazard image to go with it. http://malde.org/~ketil/Hazard_lambda.svg Cool! Can we have a license to reuse that image? (I want it on a T-shirt) Cheers, Simon ___

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

2007-09-05 Thread Brandon S. Allbery KF8NH
On Sep 5, 2007, at 6:47 , Ketil Malde wrote: On Wed, 2007-09-05 at 09:56 +0100, Simon Peyton-Jones wrote: Good point. Not so easy for multi-parameter type classes! E.g. No instance for (Bar String Int). So we could have String is not an instance of class Foo -- single param

Re: [Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 12:06 +0100, Simon Marlow wrote: > Ketil Malde wrote: > >> WARNING: Learning Haskell is dangerous to your health! > > > > :-) I liked that so much I made a hazard image to go with it. > > > > http://malde.org/~ketil/Hazard_lambda.svg > > Cool! Can we have a license to reus

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

2007-09-05 Thread Jules Bean
Ketil Malde wrote: String is not an instance of class Foo -- single param No instance for (Bar String Int)-- multi-param If you quote things, you can also consider: 'String Int' is not an instance of class 'Bar'. Downside is that 'String Int' by it

[Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread jerzy . karczmarczuk
Simon Marlow writes: Ketil Malde wrote: WARNING: Learning Haskell is dangerous to your health! :-) I liked that so much I made a hazard image to go with it. http://malde.org/~ketil/Hazard_lambda.svg Cool! Can we have a license to reuse that image? (I want it on a T-shirt) People, are yo

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

2007-09-05 Thread Dan Piponi
On 9/5/07, Ketil Malde <[EMAIL PROTECTED]> wrote: > On Wed, 2007-09-05 at 08:19 +0100, Simon Peyton-Jones wrote: > Error message from GHCi: > test/error.hs:2:8: > No instance for (Num String) > arising from use of `+' at test/error.hs:2:8-17 > Possible fix: add an inst

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

2007-09-05 Thread Bulat Ziganshin
Hello Simon, Wednesday, September 5, 2007, 11:19:28 AM, you wrote: > when you come across a case where GHC produces an > unhelpful message, send it in, along with the program > that produced it, i have put such tickets about year ago :) basically, it was about just chang

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

2007-09-05 Thread Bulat Ziganshin
Hello Simon, Wednesday, September 5, 2007, 12:56:18 PM, you wrote: > String is not an instance of class Foo -- single param > No instance for (Bar String Int)-- multi-param > Would that be better (single-param case is easier), or worse (inconsistent)? easier - m

[Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Simon Michael
I agree actually. That picture, while very cool, won't help Haskell marketing one bit. :) Lisp's "made with alien technology" is much more inviting: http://www.lisperati.com/logo.html . I wish we could use it! ___ Haskell-Cafe mailing list Haskel

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

2007-09-05 Thread Sterling Clover
I'd prefer something slightly more specific, such as instead of No instance for (Num String) arising from use of `+' at test/error.hs:2:8-17 Possible fix: add an instance declaration for (Num String) In the expression: x + (show s) In the definition of `f

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

2007-09-05 Thread Twan van Laarhoven
Bulat Ziganshin wrote: Hello Simon, Wednesday, September 5, 2007, 11:19:28 AM, you wrote: when you come across a case where GHC produces an unhelpful message, send it in, along with the program that produced it, i have put such tickets about year ago :) basically, it

[Haskell-cafe] Block-wise lazy sequences in Haskell

2007-09-05 Thread Henning Thielemann
I want to have a data structure like Data.ByteString.Lazy, that is block-wise lazy, but polymorphic. I could use a lazy list of unboxed arrays (UArray) but the documentation says, that the element types are restricted. But I will need (strict) pairs of Double and the like as elements. It see

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

2007-09-05 Thread Jonathan Cast
On Wed, 2007-09-05 at 19:50 +0200, Twan van Laarhoven wrote: > Bulat Ziganshin wrote: > > Hello Simon, > > > > Wednesday, September 5, 2007, 11:19:28 AM, you wrote: > > > > > >>when you come across a case where GHC produces an > >>unhelpful message, send it in, along with the pro

Re: [Haskell-cafe] Block-wise lazy sequences in Haskell

2007-09-05 Thread Bryan O'Sullivan
Henning Thielemann wrote: I thought it must be possible to define an unboxed array type with Storable elements. Yes, this just hasn't been done. There would be a few potentially tricky corners, of course; Storable instances are not required to be fixed in size, though all the precanned ins

Re: [Haskell-cafe] Block-wise lazy sequences in Haskell

2007-09-05 Thread Henning Thielemann
On Wed, 5 Sep 2007, Bryan O'Sullivan wrote: Henning Thielemann wrote: I thought it must be possible to define an unboxed array type with Storable elements. Yes, this just hasn't been done. There would be a few potentially tricky corners, of course; Storable instances are not required to

[Haskell-cafe] Mutable but boxed arrays?

2007-09-05 Thread Henning Thielemann
Can someone explain me, why there are arrays with mutable but boxed elements? I thought that boxing is only needed for lazy evaluation. However if I access an element of an array that is the result of a sequence of in-place updates, all updates must be executed in order to get the final value

Re: [Haskell-cafe] Block-wise lazy sequences in Haskell

2007-09-05 Thread Stefan O'Rear
On Wed, Sep 05, 2007 at 07:54:34PM +0200, Henning Thielemann wrote: > > I want to have a data structure like Data.ByteString.Lazy, that is > block-wise lazy, but polymorphic. I could use a lazy list of unboxed arrays > (UArray) but the documentation says, that the element types are restricted.

Re: [Haskell-cafe] Mutable but boxed arrays?

2007-09-05 Thread Chaddaï Fouché
I'm not sure I understand your point : why would access to a specific element of the array make all the other elements evaluate (or even this specific element as long as you don't deconstruct it). Besides you misunderstood the "box" concept, indeed only primitive values that fits in 32 bits can be

Re: [Haskell-cafe] Mutable but boxed arrays?

2007-09-05 Thread Chaddaï Fouché
2007/9/5, Chaddaï Fouché <[EMAIL PROTECTED]>: > indeed only primitive values that fits in 32 bits can be unboxed Note that there are some cases which could make you doubt that, like the UArray Bool (bool isn't a primitive type), but that's because UArray Bool don't really use unboxed bool, it's a

Re: [Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Albert Y. C. Lai
[EMAIL PROTECTED] wrote: People, are you crazy, with my deepest respect and friendliness... You want to frighten newbies? it seems that they have already a good dose of allergy... I am way over 30 years old, and my age would have me agree with you. But I have also looked at the culture of peop

Re: [Haskell-cafe] Mutable but boxed arrays?

2007-09-05 Thread Jonathan Cast
On Wed, 2007-09-05 at 20:37 +0200, Henning Thielemann wrote: > Can someone explain me, why there are arrays with mutable but boxed > elements? I thought that boxing is only needed for lazy evaluation. > However if I access an element of an array that is the result of a > sequence of in-place upd

[Haskell-cafe] Re: [Haskell] (no subject)

2007-09-05 Thread Scott Williams
[bcc haskell, cc haskell-cafe] On 9/5/07, Tomi Owens <[EMAIL PROTECTED]> wrote: > > Hi there. I'm a teacher of Maths and am working my way through the Euler > Project problems for fun. I have mostly been using Basic, but have read up > about Haskell and think it looks like a sensible way to solve

Re: [Haskell-cafe] Re: [Haskell] (no subject)

2007-09-05 Thread Thomas Hartman
I think you want something like this {-# OPTIONS -fglasgow-exts #-} f :: (Integer, Float) -> Integer f (a,b) = a * floor (10/b) lst :: [(Integer, Integer)] lst = [(a ^ 2 + b ^ 2, a) | a <- [1..4], b <- [1..4], a^2 + b^2 < 20, b <= a] lst3 = map (f) ( map ( intTupToFloatTup ) lst ) intTu

Re: [Haskell-cafe] About mplus

2007-09-05 Thread ajb
G'day all. Slight nit... Quoting ok <[EMAIL PROTECTED]>: I've been thinking about making a data type an instance of MonadPlus. From the Haddock documentation at haskell.org, I see that any such instance should satisfy mzero `mplus` x = x x `mplus` mzero = x mzero >>= f

Re: [Haskell-cafe] ANNOUNCE: xmonad 0.3

2007-09-05 Thread Max Vasin
2007/9/5, Peter Verswyvelen <[EMAIL PROTECTED]>: > Looks really nice, but if I understand it correctly it is specific for > X, so does not work on Windows? This kind of programs is impossible in Windows. Of cause you can use X server for Windows and xmonad as window manager with X server. > If so,

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

2007-09-05 Thread Peter Verswyvelen
Instead of just adapting the compiler to give better errors, it would really help if a unique identifier was assigned to each error/warning, and if a WIKI and help file existed that describes the errors in detail. Maybe this is already the case, but after a quick search I failed to find such a

[Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Niko Korhonen
Paul Johnson wrote: > For software developers who need to produce highly reliable software at > minimum cost, Haskell is a pure functional programming language that > reduces line count by 75% through reusable higher order functions and > detects latent defects with its powerful static type system.

Re: [Haskell-cafe] Mutable but boxed arrays?

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 20:37 +0200, Henning Thielemann wrote: > Can someone explain me, why there are arrays with mutable but boxed > elements? I, on the other hand, have always wondered why the strict arrays are called "unboxed", rather than, well, "strict"? Strictness seems to be their observab

Re: [Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-05 Thread Ketil Malde
On Wed, 2007-09-05 at 09:54 -0700, Simon Michael wrote: > I agree actually. That picture, while very cool, won't help Haskell > marketing one bit. :) Avoid success at all costs, remember? > Lisp's "made with alien technology" is much more inviting: > http://www.lisperati.com/logo.html . Tru