Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor bug fixes for yaml-to-dhall error messages #1305

Merged

Conversation

robbiemcmichael
Copy link
Collaborator

Fixes a type mismatch error message which mentions JSON.


Fixes an "arithmetic overflow" exception which occurs when attempting to parse a negative number as a Natural.

Current behaviour:

$ yaml-to-dhall Natural <<< -1

arithmetic underflow

With fix applied:

$ yaml-to-dhall Natural <<< -1

Error: Dhall type expression and YAML value do not match:

Expected Dhall type:
Natural

YAML:
-1

@sjakobi
Copy link
Collaborator

sjakobi commented Sep 11, 2019

Nice catch! It would be great to have a regression test for this, but we don't have a test setup for testing errors right now.

Note that this broke the build due to a warning though:

src/Dhall/JSONToDhall.hs:239:1: error: [-Wunused-imports, -Werror=unused-imports]
    The qualified import of ‘Dhall’ is redundant
      except perhaps to import instances from ‘Dhall’
    To import instances alone, use: import Dhall()
    |
239 | import qualified Dhall
    | ^^^^^^^^^^^^^^^^^^^^^^

@Gabriella439
Copy link
Collaborator

Also, to fix the build failure, just remove the now-unused import qualified Dhall from the JSONToDhall module:

https://hydra.dhall-lang.org/build/32689/nixlog/4/tail

Fixes a type mismatch error message which mentions JSON.

Fixes an "arithmetic overflow" exception which occurs when attempting to
parse a negative number as a `Natural`.
@robbiemcmichael
Copy link
Collaborator Author

Thanks @sjakobi and @Gabriel439, I've removed the redundant import.

@mergify mergify bot merged commit c8402fa into dhall-lang:master Sep 11, 2019
@Gabriella439
Copy link
Collaborator

@robbiemcmichael: Thank you for fixing this! 🙂

mmhat added a commit to mmhat/dhall-haskell that referenced this pull request Oct 6, 2022
 * Added DirectoryTreeOptions type that allows one to control the
   behaviout or to-directory-tree
 * Added command line flags for these options: --allow-parent-directory
   and --allow-absolute-paths
 * Simplified code a bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants