Popularity
2.3
Stable
Activity
0.0
Stable
1
2
0

Monthly Downloads: 5
Programming language: Haskell
License: Apache License 2.0
Tags: Development     Error Handling    
Latest version: v0.1.0.0

pretty-error alternatives and similar packages

Based on the "Error Handling" category.
Alternatively, view pretty-error alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of pretty-error or a related project?

Add another 'Error Handling' Package

README

pretty-error

Sometimes you need to assume something at runtime that you can't prove in the type system. When you do that, you should make sure you get a good error message if ever your assumption turns out to be wrong. That's what this library is for.

Use the functions in here to get high quality error messages for when your invariants don't hold at runtime. The functions all pretty print any Haskell values given to them, which makes it easier to understand what's going on when your code breaks.

Examples

assertRight for a successful assertion:

>>> assertRight "Example message" (Right 42)
42

assertRight for a failed assertion:

>>> assertRight "Example message" (Left "unexpected error")
*** Exception: Example message: "unexpected error"

Using fromRight to unpack an Either that is actually a Left:

>>> fromRight (Left ["foo","bar","baz"])
*** Exception: [ "foo" , "bar" , "baz" ]