Comments (9)
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.
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.
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 --detail
ed error messages so that it's easier to obtain: #76
from dhall-haskell.
-
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.
@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.
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.
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.
@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.
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)
- No documentation for accessing nested unions HOT 4
- Failure to Decode Expression with extended Builtin Function HOT 1
- Document the significance of `Nothing :: Maybe CharacterSet`
- Please report symlink contents for `Error: Missing file` HOT 2
- Error generating docs
- combine `let` bindings in `dhall format` HOT 1
- Support request for `aeson` 2.2 in `dhall` HOT 2
- dhall-to-yaml does not properly quote strings HOT 1
- Can not install dhall-lsp-server HOT 2
- Allow hnix 0.17
- Hackage build failed for dhall-toml-1.0.3
- Get back into Stackage Nightly with GHC 9.8 HOT 1
- Missing binaries in release HOT 1
- Hackage release for dhall-lsp-server HOT 1
- Build failure on GHC 9.8.1: 'Illegal invisible type variable binder'
- Report imports HOT 1
- dhall-docs: Prelude.head: empty list
- Suggesting a new construct for dealing with optional fields in Dhall defaults
- dhall-json bound on aeson can be relaxed
- Questions regarding the right strategy for upgrading to ghc-9.8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhall-haskell.