dhall-lang / dhall-json

This repository has moved to https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-json
BSD 3-Clause "New" or "Revised" License
65 stars 6 forks source link

Sort in record not supported ? #70

Closed haitlahcen closed 5 years ago

haitlahcen commented 5 years ago

Dhall 1.18 introduced kind-polymorphism thanks to a Sort constant above Kind.

Generating yaml|json from a value annotated by fixing a Sort contained by a record throws an error

test.dhall

    let A = { X = { a : Text }, Y = λ(K : Type) → { a : K } }

in  { a = 1 } : A.Y Natural

dhall <<< ./test.dhall

{ a = 1 }

dhall-to-yaml <<< ./test.dhall

Error: Invalid field type

{ X = { a : Text }, Y = λ(K : Type) → { a : K } }

Extracting Y from A make the above command working. Am I missing something or this behavior was not expected ?

Gabriella439 commented 5 years ago

@haitlahcen: I think you might be using a version of dhall-to-yaml that was built against an older version of dhall. The example you gave works for me for both dhall-1.18 and dhall-json-1.2.4:

$ dhall <<< './example.dhall' 
{ a = 1 }

$ dhall-to-yaml <<< './example.dhall' 
a: 1
haitlahcen commented 5 years ago

I just noticed that my build through nix was not for the latest, was running dhall-json 1.2.3, sorry for that ^^

Gabriella439 commented 5 years ago

@haitlahcen: No worries at all :slightly_smiling_face: