timbertson / dhall-render

Render multiple files from dhall expressions
BSD Zero Clause License
18 stars 7 forks source link

change how with is used in schemas #2

Closed craig-day closed 4 years ago

craig-day commented 4 years ago

I ran into some syntax errors around the with operator when following the bootstrapping steps. These are the two changes I had to make and it seems happy now!

➔ echo '(./files.dhall).files.dhall-render.contents' | dhall text | ruby
dhall:
↳ ./files.dhall
  ↳ https://raw.githubusercontent.com/timbertson/dhall-render/7f41fbfdfb86e1b9bbbf614a6577979bd91c07b1/package.dhall
    ↳ https://raw.githubusercontent.com/timbertson/dhall-render/7f41fbfdfb86e1b9bbbf614a6577979bd91c07b1/schemas.dhall
Error: Invalid input
https://raw.githubusercontent.com/timbertson/dhall-render/7f41fbfdfb86e1b9bbbf614a6577979bd91c07b1/schemas.dhall:30:51:
   |
30 |       \(format : Format) -> \(T : Type) -> File T with default.format = format
   |                                                   ^^
unexpected "wi"
expecting ->, :, keyword, or whitespace
1│ ./schemas.dhall
https://raw.githubusercontent.com/timbertson/dhall-render/7f41fbfdfb86e1b9bbbf614a6577979bd91c07b1/package.dhall:1:1
craig-day commented 4 years ago

For the sake of recording it somewhere, the problems with the with keyword came after upgrading to 1.33.0, I then ran into another problem with record puns:

➔ echo '(./files.dhall).files.dhall-render.contents' | dhall text | ruby

↳ https://raw.githubusercontent.com/craig-day/dhall-render/craig-day/with-errors/package.dhall
  ↳ https://raw.githubusercontent.com/craig-day/dhall-render/craig-day/with-errors/schemas.dhall

Error: Invalid input

https://raw.githubusercontent.com/craig-day/dhall-render/craig-day/with-errors/schemas.dhall:43:5:
   |
43 |     , Format
   |     ^
unexpected ','
expecting whitespace or }

1│ ./schemas.dhall

https://raw.githubusercontent.com/craig-day/dhall-render/craig-day/with-errors/package.dhall:1:1

This was resolved by also upgrading dhall-json to 1.6.4. I went back to check and with both dhall and dhall-json on the latest, these changes are still needed so the with operator works correctly.

timbertson commented 4 years ago

Thanks!