Best workflow for decoupling JSON


#1

need some help for dhall+JSON here,I am using dhall-json to convert json to dhall with https://prelude.dhall-lang.org/JSON/Type as the schema but when trying to decouple the json into smaller files and import them back im getting :

 Error: Unbound variable: json

1│ json

Im guessing because the JSON variable/Type definition stayed in the main file, what should be the right way to approach this?


#2

@countoren: Yeah, when a Dhall file imports another Dhall file the variables that were in scope within the parent Dhall expression are not threaded to the imported child Dhall expression.

The simplest way to fix this is to import json again within the child Dhall expression.

See also: https://docs.dhall-lang.org/tutorials/Language-Tour.html#file-imports