Skip to content
Permalink
Browse files

Relocate `./Prelude/Map.dhall` to `./Prelude/Map/Type.dhall` (#608)

... as suggested in #586 (comment)
  • Loading branch information...
Gabriel439 committed Jun 29, 2019
1 parent 7f662e4 commit 3efe5695d06e429067a842af27e642fc97ae08e5
Showing with 41 additions and 27 deletions.
  1. +11 −21 Prelude/Map.dhall
  2. +24 −0 Prelude/Map/Type
  3. +2 −2 Prelude/Map/keys
  4. +2 −2 Prelude/Map/map
  5. +2 −2 Prelude/Map/values
@@ -1,24 +1,14 @@
{- This is the canonical way to encode a dynamic list of key-value pairs.
{- This file is provided for backwards compatibility since `./Map.dhall`
was relocated to `./Map/Type`
Tools (such as `dhall-to-json`/`dhall-to-yaml` will recognize values of this
type and convert them to maps/dictionaries/hashes in the target language
The main reason for standardizing on a `./*/Type` convention is so that
there can eventually be a one-to-one correspondence between Prelude files and
the fields of the `package.dhall` Prelude record once we can store types
within that record. So, for example, there will eventually be a
`Prelude.Map.Type` field corresponding to `./Prelude/Map/Type`.
For example, `dhall-to-json` converts a Dhall value like this:
```
[ { mapKey = "foo", mapValue = 1 }
, { mapKey = "bar", mapValue = 2 }
] : ./Map Text Natural
```
... to a JSON value like this:
```
{ "foo": 1, "bar", 2 }
```
At some point we will remove this file after a sufficiently long
deprecation cycle.
-}
let Map
: Type Type Type
= λ(k : Type) λ(v : Type) List { mapKey : k, mapValue : v }

in Map
./Map/Type sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ./Map/Type
@@ -0,0 +1,24 @@
{- This is the canonical way to encode a dynamic list of key-value pairs.
Tools (such as `dhall-to-json`/`dhall-to-yaml` will recognize values of this
type and convert them to maps/dictionaries/hashes in the target language
For example, `dhall-to-json` converts a Dhall value like this:
```
[ { mapKey = "foo", mapValue = 1 }
, { mapKey = "bar", mapValue = 2 }
] : ./Map Text Natural
```
... to a JSON value like this:
```
{ "foo": 1, "bar", 2 }
```
-}
let Map
: Type Type Type
= λ(k : Type) λ(v : Type) List { mapKey : k, mapValue : v }

in Map
@@ -17,8 +17,8 @@ Examples:
-}

let Map =
../Map.dhall sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ../Map.dhall
./Type sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ./Type

let Entry =
./Entry sha256:f334283bdd9cd88e6ea510ca914bc221fc2dab5fb424d24514b2e0df600d5346
@@ -21,8 +21,8 @@ Examples:
-}

let Map =
../Map.dhall sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ../Map.dhall
./Type sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ./Type

let Entry =
./Entry sha256:f334283bdd9cd88e6ea510ca914bc221fc2dab5fb424d24514b2e0df600d5346
@@ -17,8 +17,8 @@ Examples:
-}

let Map =
../Map.dhall sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ../Map.dhall
./Type sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
? ./Type

let Entry =
./Entry sha256:f334283bdd9cd88e6ea510ca914bc221fc2dab5fb424d24514b2e0df600d5346

0 comments on commit 3efe569

Please sign in to comment.
You can’t perform that action at this time.