type-errors-pretty: Combinators for writing pretty type errors easily

[ library, mpl, type-errors, types ] [ Propose Tags ]

This library provides replacements for the ErrorMessage constructors to write the text of custom error messages easily.


[Skip to Readme]
Versions [faq] 0.0.0.0, 0.0.1.0, 0.0.1.1
Change log CHANGELOG.md
Dependencies base (>=4.10.1.0 && <4.15) [details]
License MPL-2.0
Copyright 2019-2020 Dmitrii Kovanikov
Author Dmitrii Kovanikov
Maintainer Dmitrii Kovanikov <kovanikov@gmail.com>
Revised Revision 1 made by shersh at 2020-06-03T10:19:19Z
Category Types, Type Errors
Home page https://github.com/chshersh/type-errors-pretty
Bug tracker https://github.com/chshersh/type-errors-pretty/issues
Source repo head: git clone https://github.com/chshersh/type-errors-pretty.git
Uploaded by shersh at 2020-04-18T18:20:48Z
Distributions NixOS:0.0.1.1
Downloads 1693 total (157 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for type-errors-pretty-0.0.1.1

[back to package description]

type-errors-pretty

pretty-bug

GitHub CI Build status Windows build status Hackage Stackage Lts Stackage Nightly MPL-2.0 license

"It is important that we forgive ourselves for making mistakes. We need to learn from our errors and move on."

― Steve Maraboli, Life, the Truth, and Being Free

Combinators for writing pretty type errors easily. The word pretty here doesn't mean that the resulting type errors will be pretty (though, I believe they will be awesome), but the way the type errors are defined in your code is pretty.

If you're interested in motivation behind using type errors at first place, you can read the following blog post:

The type-errors-pretty library allows you to write the text of custom compile-time error messages with less effort in the following way:

import Type.Errors.Pretty (type (<>), type (%))


type MessageText (e1 :: k) (e2 :: k) (es :: [k])
    = "You require the following two effects from your computation:"
    % ""
    % "    '" <> e1 <> "' and '" <> e2 <> "'"
    % ""
    % "However, your monad is capable of performing only the following effects:"
    % ""
    % "    " <> es

Acknowledgement

Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY.