Skip to content

Instantly share code, notes, and snippets.

@aljce
Created August 20, 2020 17:02
Show Gist options
  • Save aljce/d38f5341efb0fda1e96bae15dae3a8c4 to your computer and use it in GitHub Desktop.
Save aljce/d38f5341efb0fda1e96bae15dae3a8c4 to your computer and use it in GitHub Desktop.
let Map = http://prelude.dhall-lang.org/Map/Type
let Entry = http://prelude.dhall-lang.org/Map/Entry
let map = http://prelude.dhall-lang.org/Map/map
let TerraformType
: Type
= ∀(type : Type) →
∀(TerraformString : type) →
∀(TerraformNumber : type) →
∀(TerraformBool : type) →
∀(TerraformList : type → type) →
∀(TerraformSet : type → type) →
∀(TerraformMap : type → type) →
∀(TerraformObject : Map Text type → type) →
type
let TerraformString
: TerraformType
= λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformString
let TerraformNumber
: TerraformType
= λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformNumber
let TerraformBool
: TerraformType
= λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformBool
let TerraformList
: TerraformType → TerraformType
= λ(terraformType : TerraformType) →
λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformList
( terraformType
type
TerraformString
TerraformNumber
TerraformBool
TerraformList
TerraformSet
TerraformMap
TerraformObject
)
let TerraformSet
: TerraformType → TerraformType
= λ(terraformType : TerraformType) →
λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformSet
( terraformType
type
TerraformString
TerraformNumber
TerraformBool
TerraformList
TerraformSet
TerraformMap
TerraformObject
)
let TerraformMap
: TerraformType → TerraformType
= λ(terraformType : TerraformType) →
λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformMap
( terraformType
type
TerraformString
TerraformNumber
TerraformBool
TerraformList
TerraformSet
TerraformMap
TerraformObject
)
let TerraformObject
: Map Text TerraformType → TerraformType
= λ(terraformObject : Map Text TerraformType) →
λ(type : Type) →
λ(TerraformString : type) →
λ(TerraformNumber : type) →
λ(TerraformBool : type) →
λ(TerraformList : type → type) →
λ(TerraformSet : type → type) →
λ(TerraformMap : type → type) →
λ(TerraformObject : Map Text type → type) →
TerraformObject
( map
Text
TerraformType
type
( λ(terraformType : TerraformType) →
terraformType
type
TerraformString
TerraformNumber
TerraformBool
TerraformList
TerraformSet
TerraformMap
TerraformObject
)
terraformObject
)
let renderTerraformType
: TerraformType → Text
= λ(terraformType : TerraformType) →
terraformType
Text
"string"
"number"
"bool"
(λ(type : Text) → "list(${type})")
(λ(type : Text) → "set(${type})")
(λ(type : Text) → "map(${type})")
(λ(type : Map Text Text) → "unimplemented")
in renderTerraformType (TerraformList (TerraformSet TerraformNumber))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment