| 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, 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
| 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
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
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
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
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'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
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
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
Henning Thielemann wrote:
If you are happy with writing do {1;2;3;4} you are certainly also happy
with cv [1,2,3,4], where cv means 'convert' and is a method of a class
for converting between lists and another sequence type.
class ListCompatible lc where
cv :: [a] - lc a
rt :: lc a - [a]
On Tue, 2007-09-04 at 16:06 +0200, Peter Verswyvelen wrote:
Henning Thielemann wrote:
If you are happy with writing do {1;2;3;4} you are certainly also happy
with cv [1,2,3,4], where cv means 'convert' and is a method of a class
for converting between lists and another sequence type.
Jonathan Cast wrote:
I don't think this has been mentioned explicitly yet, but the
discrepancy is purely for pedagogical purposes.
In Gofer, list comprehensions (and list syntax, IIRC) /was/ generalized
(to an arbitrary instance of MonadPlus). But that means that any
mistake in your syntax
On Tue, 2007-09-04 at 23:03 +0200, Peter Verswyvelen wrote:
Jonathan Cast wrote:
I don't think this has been mentioned explicitly yet, but the
discrepancy is purely for pedagogical purposes.
In Gofer, list comprehensions (and list syntax, IIRC) /was/ generalized
(to an arbitrary
On Sep 4, 2007, at 5:03 PM, Peter Verswyvelen wrote:
Otherwise you would need a very clever compiler/editor machine
learning system, that looks at how a class of users fixes a certain
error, so the compiler can adapt its error message the next time a
similar pattern occurs (which is
Okay. Now the following might not make sense at all, but... isn't the
abstract concept of a list just a sequence of elements (okay, with a
whole lot of extra properties)? So couldn't we write: do { 1;2;3;4 }
instead of [1,2,3,4] somehow for some special list builder monad? And
then do
On Mon, 3 Sep 2007, Peter Verswyvelen wrote:
Okay. Now the following might not make sense at all, but... isn't the
abstract concept of a list just a sequence of elements (okay, with a
whole lot of extra properties)? So couldn't we write: do { 1;2;3;4 }
instead of [1,2,3,4] somehow for some
I like the fact that Haskel treats numbers in a generic way, so you can
lift them to any other datatype by instantiating Num.
Can the same be done on other builtin constructs? For example, if I have
[a], can this list be lifted to other types? I guess not, because no
type class exists for the
Chaddaï Fouché wrote:
You can indeed already do that, except it won't be a single instance
since list have a bucketful of interesting properties. A good starting
is looking at what list is an instance of and trying to identify the
set of instance which interest us in this case, Foldable and
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.
Snif, this is sad... :-( Oh well, maybe this gets improved in Haskell
Prime ;-)
Lennart Augustsson wrote:
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
25 matches
Mail list logo