Re: [Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-07 Thread Steffen Schuldenzucker


This one[1] sounds so awesome! I just read the paper.
In particular I like how one could access the current call stack 
structure live.


However, the most recent changes to the code are from early 2009.
Anyone knows what happened to this?

[1] 
http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack/CorePassImplementation


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-06 Thread Steffen Schuldenzucker

Dear Café,

I'm working on a EDSL that will include both type checks (at compile
time) and semantic checks (at run time). - Semantic properties are known
at compile time but feel too complex to me to be encoded in the type system.

If one of the runtime checks fails, I'd like to print the location of 
the error, i.e. not

  Error: Unknown field `AMOUNT' in table `ENTRIES'
(where? why?)
but
  Error: Unknown field `AMOUNT' in table `ENTRIES'
  Referenced at analysis1.hs:43:7 by `sumByInvoice'
which was called at analysis1.hs:66:3 by `main'
  ENTRIES defined at analysis1.hs:13:8

I'm not yet sure which level of granularity I want for error messages
and one can probably get arbitrarily fancy on this.
For the moment I think it would be enough to auto-insert the location of
calls to a certain set of functions.

Any experience on this?

Thanks a lot.
-- Steffen


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-06 Thread Kim-Ee Yeoh
On Sun, Apr 7, 2013 at 12:23 AM, Steffen Schuldenzucker
sschuldenzuc...@uni-bonn.de wrote:
 For the moment I think it would be enough to auto-insert the location of
 calls to a certain set of functions.

Have you tried assert [1]?

[1] 
http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Exception.html#v:assert

-- Kim-Ee

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-06 Thread Daniel Trstenjak

Hi Steffen,

most of the time I'm just using these cpp macros:

#define __POS__(__FILE__ ++ : ++ show __LINE__)
#define ERROR  error $ __POS__ ++  -  ++


Instead of writing 'error blub' you would write 'ERROR blub'
and additionally get the file name and the line.


There's a bracktracing functionality in the more recent versions of
ghc. I think it has been discussed on this mailing list.


Greetings,
Daniel

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-06 Thread Steffen Schuldenzucker


Good Point!
Doesn't quite meet my requirements (I don't want to show the error loc 
somewhere deep within the libs), but it led me here[1].

Reading through that now...

[1] http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack

On 04/06/2013 07:51 PM, Kim-Ee Yeoh wrote:

On Sun, Apr 7, 2013 at 12:23 AM, Steffen Schuldenzucker
sschuldenzuc...@uni-bonn.de  wrote:

For the moment I think it would be enough to auto-insert the location of
calls to a certain set of functions.


Have you tried assert [1]?

[1] 
http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Exception.html#v:assert

-- Kim-Ee



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] code-as-config, run-time checks and error locations

2013-04-06 Thread Kim-Ee Yeoh
On Sun, Apr 7, 2013 at 4:37 AM, Steffen Schuldenzucker
sschuldenzuc...@uni-bonn.de wrote:
 Reading through that now...
 [1] http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack

If you're reading that page, you probably also want to get up to speed
on the latest. The thread titled RFC: rewrite-with-location proposal
just ended recently [1].

[1] http://www.haskell.org/pipermail/haskell-cafe/2013-February/106617.html

-- Kim-Ee

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe