Git Product home page Git Product logo

Comments (9)

Gabriella439 avatar Gabriella439 commented on June 8, 2024

It sounds like there are several questions being asked here:

  • Can Dhall provide more detail by default (without --explain) when there is a type mismatch?

    Yes, I can definitely do that

  • If the types differ by a single field, can Dhall just specify which field was wrong?

    It's possible, but I doubt I will implement this any time soon because it adds a lot of complexity

  • Can Dhall provide support for type synonyms?

    Probably not, for the reasons outlined here: #10

from dhall-haskell.

Profpatsch avatar Profpatsch commented on June 8, 2024

Yes, I can definitely do that

Yes, I tested that. It’s just that the default output is unhelpful in that case.

It's possible, but I doubt I will implement this any time soon because it adds a lot of complexity

I was afraid that’s the case, yes.

Probably not, for the reasons outlined here: #10

Trying to grok the answers in that thread (…processing…)

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

For the first issue you raised I will implement an intermediate solution for now, which is to put the relevant information at the end of --detailed error messages so that it's easier to obtain: #76

from dhall-haskell.

AnthonyJacob avatar AnthonyJacob commented on June 8, 2024
  1. It's possible, but I doubt I will implement this any time soon because it adds a lot of complexity

Isn't it just simple diff? Why should it report only one field and not all?

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

@AnthonyJacob: I'm referring to the complexity of computing a diff for arbitrary Dhall types (as opposed to just the diff of two record types). For example, consider this more complex expression:

< foo = { bar = 1, baz = 2 } | qux : Bool > : < foo : { bar : Integer, baz : Double } | qux : Bool >

This would give us the following error:

...
You or the interpreter annotated this expression:

↳ < foo = { bar = 1, baz = 2 } | qux : Bool >

... with this type or kind:

↳ < foo : { bar : Integer, baz : Double } | qux : Bool >

... but the inferred type or kind of the expression is actually:

↳ < foo : { bar : Integer, baz : Integer } | qux : Bool >
...

However, really the error we want is that the baz field had the wrong type (with a trail of breadcrumbs pointing to how to get to that field from the outermost type

Implementing a diff that supports that sort of type error is more complex to implement

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

Just an update that Dhall now supports type aliases in master

However, I'm still keeping this open because there is still the issue of providing better error messages

from dhall-haskell.

quasicomputational avatar quasicomputational commented on June 8, 2024

I've been playing with dhall-to-cabal, and the errors really, really aren't good with larger types. See https://gist.github.com/quasicomputational/330193aabe69abdfc1400b37f6af6670 for an example.

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

@quasicomputational: See if you can build dhall-to-cabal against dhall-1.13.0. The latest version of the dhall package added support for concise type diffs explaining why there is a type mismatch (this was a feature implemented specifically with dhall-to-cabal in mind).

See: #336

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

I will close this since the original issue was fixed by adding support for type synonyms and the latter issue should be fixed by dhall's support for type diffs in error messages

from dhall-haskell.

Related Issues (20)

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.