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

2007-09-05 Thread ok
On 4 Sep 2007, at 6:47 am, Vimal wrote: In my Paradigms of Programming course, my professor presents this piece of code: while E do S if F then break end T end He then asked us to *prove* that the above programming fragment cannot be implemented just using if and while

Re: [Haskell-cafe] About mplus

2007-09-05 Thread Henning Thielemann
On Tue, 4 Sep 2007, David Benbennick wrote: On 9/4/07, ok [EMAIL PROTECTED] wrote: 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`

Re: [Haskell-cafe] About mplus

2007-09-05 Thread ok
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, so it is

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

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

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 arises

[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

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

[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

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

[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 reuse that image?

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

[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

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 instance

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

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 -

[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

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

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

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 program

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

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

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 )

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