Code Monkey home page Code Monkey logo

type-errors-pretty's Introduction

type-errors-pretty

pretty-bug

GitHub CI Hackage 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.

type-errors-pretty's People

Contributors

chshersh avatar vrom911 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

type-errors-pretty's Issues

Upload 0.0.1.0 to Hackage?

Hi!

Is there something holding back the 0.0.1.0 version of this package from being uploaded to Hackage?

I am interested because I want to get polysemy to build with the latest stackage nightlies for ghc 8.8

Thanks in advance!

Too strict version requirements for ghc9.2.1

Tried building souffle-haskell with ghc9.2.1, which depends on this package.
Got this error:

Setup: Encountered missing or private dependencies:
base >=4.10.1.0 && <4.16

Looking at https://wiki.haskell.org/Base_package, ghc9.2.1 uses base 4.16.
Tried relaxing the constraints with doJailbreak in nix, but looks like things actually changed in base:

running tests
Running 1 test suites...
Test suite doctest: RUNNING...

src/Type/Errors/Pretty.hs:114:21: error:
    • Expected kind ‘k’, but ‘t :: Symbol’ has kind ‘Symbol’
    • In the first argument of ‘ToErrorMessage’, namely ‘(t :: Symbol)’
      In the type family declaration for ‘ToErrorMessage’
src/Type/Errors/Pretty.hs:82: failure in expression `:kind! "Integer values have type: " <> Int'
expected: "Integer values have type: " <> Int :: ErrorMessage
          = 'Text "Integer values have type: " ':<>: 'ShowType Int
 but got: 
          ^
          <interactive>:1:30: error:
              Not in scope: type constructor or class ‘<>’

src/Type/Errors/Pretty.hs:98: failure in expression `:kind! "Expecting value of type: " % "   " <> Integer'
expected: "Expecting value of type: " % "   " <> Integer :: ErrorMessage
          = 'Text "Expecting value of type: "
            ':$$: ('Text "   " ':<>: 'ShowType Integer)
 but got: 
          ^
          <interactive>:1:29: error:
              Not in scope: type constructor or class ‘%’
          
          <interactive>:1:37: error:
              Not in scope: type constructor or class ‘<>’

Examples: 2  Tried: 2  Errors: 0  Failures: 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.