[Haskell] modern language design, stone age tools

S. Alexander Jacobson alex at alexjacobson.com
Thu Jun 24 16:57:23 EDT 2004


Hmm, those options don't work with ghci (where you
are more likely to be debugging).

Also, is there a way to get the typesystem to
tell you which functions may fail i.e. which
functions have failMsg as an implicit parameter?

-Alex-

_________________________________________________________________
S. Alexander Jacobson                  mailto:me at alexjacobson.com
tel:917-770-6565                       http://alexjacobson.com




On Thu, 24 Jun 2004, Simon Peyton-Jones wrote:

> Switching on profiling (-prof -auto-all) does essentially just this. The
> cost centre stack is just like an implicit parameters, only one that
> does not show up in the types.
>
> Since there really is some extra parameter passing going on, you really
> do need to recompile (all) the code.  That's a nuisance, but it's a
> price that I can't see how to avoid in a call-by-need language.
>
> Simon
>
> | -----Original Message-----
> | From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
> On Behalf Of Alastair Reid
> | Sent: 23 June 2004 21:44
> | To: S. Alexander Jacobson
> | Cc: haskell at haskell.org
> | Subject: Re: [Haskell] modern language design, stone age tools
> |
> | On Wednesday 23 June 2004 20:38, S. Alexander Jacobson wrote:
> | > It would be really nice if you could pass an
> | > error message down to every function that might
> | > fail. e.g. using implicit parameters*:
> | >
> | >    myFunc 0 x = head x with ?failMsg="myfunc 0 caused the error"
> |
> | Interesting.  Two variations on that:
> |
> | 1) Getting a 'stack' trace (i.e., a list of ancestors) can be more
> |    useful than just knowing the immediate ancestor so you might want
> |    myFunc to also take an implicit parameter and to add that
> |    parameter to what it says:
> |
> |      myFunc 0 x = head x
> |       with ?failMsg="myfunc 0 caused the error but myFunc was called
> because "
> |                    ++ ?failMsg
> |
> |    [I can't remember if with acts as a let or a letrec.  The intention
> is
> |     to use the ?failMsg passed implicitly to myFunc]
> |
> | 2) If you don't want to put errors in the type system, you could
> instead use
> |    exceptions something along the lines of:
> |
> |       myFunc 0 x = mapException
> |                      (\ err -> show err ++ "when invoked by myFunc 0")
> |                      (head x)
> |
> |    [Not quite type correct but hopefully clear enough.  The idea is to
> combine
> |     the exception value returned with some extra information about the
> context
> |     with the idea that whoever called myFunc might add extra
> information.
> |     Ideally, the Exception type would be recursive so we could build
> chains of
> |     exceptions without having to use Show.]
> |
> | --
> | Alastair Reid
> | _______________________________________________
> | Haskell mailing list
> | Haskell at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell
>



More information about the Haskell mailing list