From 76000b53b8e3c40c921017c01469abbfeaf93a39 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 21 Jul 2019 21:35:34 -0500 Subject: [PATCH] Map types are generic --- .rubocop.yml | 4 ++++ lib/dhall/types.rb | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 93a965f..c7a2302 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -73,6 +73,10 @@ Style/FormatString: Style/FormatStringToken: Enabled: false +Style/MethodName: + Exclude: + - lib/dhall/types.rb + Style/RegexpLiteral: AllowInnerSlashes: true diff --git a/lib/dhall/types.rb b/lib/dhall/types.rb index 43529e3..7feb411 100644 --- a/lib/dhall/types.rb +++ b/lib/dhall/types.rb @@ -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 -- 2.45.2