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
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`
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
| 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
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
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
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
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
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
| 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
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
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
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
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
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
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
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?
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
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
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
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
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 -
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
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
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
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
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
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
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
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 )
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
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,
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
33 matches
Mail list logo