~singpolyma/dhall-ruby

76000b53b8e3c40c921017c01469abbfeaf93a39 — Stephen Paul Weber 2 years ago 9984f63
Map types are generic
2 files changed, 14 insertions(+), 6 deletions(-)

M .rubocop.yml
M lib/dhall/types.rb
M .rubocop.yml => .rubocop.yml +4 -0
@@ 73,6 73,10 @@ Style/FormatString:
Style/FormatStringToken:
  Enabled: false

Style/MethodName:
  Exclude:
    - lib/dhall/types.rb

Style/RegexpLiteral:
  AllowInnerSlashes: true


M lib/dhall/types.rb => lib/dhall/types.rb +10 -6
@@ 4,12 4,16 @@ require "dhall/builtins"

module Dhall
	module Types
		MAP_ENTRY = RecordType.new(
			record: {
				"mapKey" => Builtins[:Text], "mapValue" => Builtins[:Text]
			}
		)
		def self.MAP_ENTRY(k: Builtins[:Text], v: Builtins[:Text])
			RecordType.new(
				record: {
					"mapKey" => k, "mapValue" => v
				}
			)
		end

		MAP = Builtins[:List].call(MAP_ENTRY)
		def self.MAP(k: Builtins[:Text], v: Builtins[:Text])
			Builtins[:List].call(MAP_ENTRY(k: k, v: v))
		end
	end
end