[commit: packages/base] master: Improve error messages for partial functions in Data.Data (d0b74ca) (Gabor Greif)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[commit: packages/base] master: Improve error messages for partial functions in Data.Data (d0b74ca) (Gabor Greif)

Krzysztof Langner
Hi Gabor,

Thank you for the feedback.
You are right about spelling. I'll fix it.

Regarding refactoring:
If I understand you correctly your suggestion is to add new function which
will wrap error message so the text will be less redundant.

I'm not sure about it. From my experience it is better to leave error
messages as simple as possible. Since when using functions in error
messages it is possible that this function will fail and then you will get
confusing error message (from inside function).
So as a rule of thumb I never add another functions inside error processing
(except the ones which makes message more meaningful).

But that's of course just my point of view.

It is also possible that I didn't understand your proposition correctly :-)


--
Thanks
Krzysztof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140102/ada38da9/attachment-0001.html>

Reply | Threaded
Open this post in threaded view
|

[commit: packages/base] master: Improve error messages for partial functions in Data.Data (d0b74ca) (Gabor Greif)

Joachim Breitner-2
Hi,

Am Donnerstag, den 02.01.2014, 10:54 +0100 schrieb Krzysztof Langner:

> I'm not sure about it. From my experience it is better to leave error
> messages as simple as possible. Since when using functions in error
> messages it is possible that this function will fail and then you will
> get confusing error message (from inside function).

for most pure Haskell functions, you can be quite certain that they
don?t fail, by following simple rules (complete patterns, no use of
partial functions like head or fromJust). So while this is might be true
in other programming languages, here you can put trust in Haskell?s type
system ? if it compiles, it works.

Greetings,
Joachim

--
Joachim ?nomeata? Breitner
  mail at joachim-breitner.de ? http://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  ? GPG-Key: 0x4743206C
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140102/fdab0dee/attachment.sig>