Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertKnownWithMsg :: String -> a -> a #100

Closed
jwaldmann opened this issue May 28, 2014 · 1 comment
Closed

assertKnownWithMsg :: String -> a -> a #100

jwaldmann opened this issue May 28, 2014 · 1 comment

Comments

@jwaldmann
Copy link
Collaborator

Currently we have assertKnown :: a -> a for run-time checks. If there are several such checks in the code, and one of them fails, I don't see which one. Ideally, I'd want the source location of the failing assertKnown in the error message.

As a work-around, we can have the programmer write a message in the assert, as in

case assertKnownWithMessage "foobar" xs of [] -> ...

of course a shorter name is preferred. The idea is similar to http://www.haskell.org/ghc/docs/7.8.2/html/users_guide/profiling.html#scc-pragma .

abau pushed a commit that referenced this issue Jun 4, 2014
@abau
Copy link
Owner

abau commented Jun 4, 2014

When compiling with CO4.Compilation.compileFile (as in most non-trivial use-cases) all assertKnown are converted to assertKnownLoc: if assertKnowLoc fails, its location in the source file is dumped.

This does not work when compiling with CO4.Compilation.compile, because source locations are provided by Language.Haskell.Exts which is not used in CO4.Compilation.compile. Again, this should't be a problem because CO4.Compilation.compile is merely used for simple examples.

@abau abau closed this as completed Jun 4, 2014
@abau abau mentioned this issue Jun 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants