A Pointless Library Proposal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
44 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: A Pointless Library Proposal

sethk
On Mon, 30 Oct 2006 16:58:40 -0800
John Meacham <[hidden email]> wrote:

> On Mon, Oct 30, 2006 at 10:16:46AM -0500, Lennart Augustsson wrote:
> > I like to use undefined is the stub for unimplemented functions since  
> > it's nice and terse.  Unfortunately, ghc doesn't give much  
> > information about where the undefined was called.
> > It would be great if the message for undefined could include file  
> > name and line number (like hbc did :).
>
> jhc has the SRCLOC_ANNOTATE pragma, which lets you attach file and line
> number information to arbitrary functions. sort of a generalization of
> the 'assert' feature of ghc. One day I will get around to implementing
> it in ghc. perhaps the next time a program I write mysteriously dies
> with "Prelude.undefined" being the only thing printed.

There are many other situations where this would be _extremely_ useful.

In my commercially deployed Haskell system, I received repeated requests for filename/line number information to be added to trace logs.

I had to resort to using a preprocessor.  This is for obvious reasons not an attractive solution.

Seth

>
>         John
>
>
> --
> John Meacham - ⑆repetae.net⑆john⑈
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/libraries
>
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: A Pointless Library Proposal

David House
In reply to this post by Donald Bruce Stewart
On 31/10/06, Donald Bruce Stewart <[hidden email]> wrote:
> But seems like we need a 'proper' solution. undefineds with lines
> numbers, and errors with line numbers, would be a good start.

I think it'd be nice to keep undefined around as a 'pure' bottom, and
introduce a new value, say 'stub :: forall a. a' which is magic and
sends the file and line location of its mention to stderr when
executed.

--
-David House, [hidden email]
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: A Pointless Library Proposal

Conor McBride
David House wrote:
> On 31/10/06, Donald Bruce Stewart <[hidden email]> wrote:
>> But seems like we need a 'proper' solution. undefineds with lines
>> numbers, and errors with line numbers, would be a good start.
>
> I think it'd be nice to keep undefined around as a 'pure' bottom, and
> introduce a new value, say 'stub :: forall a. a' which is magic and
> sends the file and line location of its mention to stderr when
> executed.

As Haskell insists that bottom is a value, it's conceptually important
to separate 'defined to be bottom' from 'not finished yet'. Never mind
the run-time stub reports, we should have compile-time stub warnings
which are as informative as possible about the task of instantiating the
stub.

Cheers

Conor



_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re[2]: A Pointless Library Proposal

Bulat Ziganshin-2
In reply to this post by David House
Hello David,

Tuesday, October 31, 2006, 1:20:42 PM, you wrote:
>> But seems like we need a 'proper' solution. undefineds with lines
>> numbers, and errors with line numbers, would be a good start.

> I think it'd be nice to keep undefined around as a 'pure' bottom, and
> introduce a new value, say 'stub :: forall a. a' which is magic and
> sends the file and line location of its mention to stderr when
> executed.

and then you will introduce exception handling? :)

i think that 'undefined' should be not function but preprocessor symbol
that's translated into "file:line" notation, and we need the same
symbol for monads while error/fail should be used for custom error
messages (as they currently used)

--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
123