From b730651e6b3b37087c71978b9665854114ef8dc6 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 7 Mar 2019 23:06:30 -0500 Subject: [PATCH] All beta normalization except for functions --- lib/dhall/ast.rb | 285 +++++++++++++----- lib/dhall/binary.rb | 72 +++-- lib/dhall/builtins.rb | 36 ++- lib/dhall/normalize.rb | 72 ++++- test/normalization/beta/DoubleA.dhallb | 1 + test/normalization/beta/DoubleB.dhallb | 1 + test/normalization/beta/DoubleLiteralA.dhallb | 1 + test/normalization/beta/DoubleLiteralB.dhallb | 1 + test/normalization/beta/DoubleShowA.dhallb | 1 + test/normalization/beta/DoubleShowB.dhallb | 1 + .../beta/DoubleShowValueA.dhallb | Bin 0 -> 30 bytes .../beta/DoubleShowValueB.dhallb | 1 + test/normalization/beta/IntegerA.dhallb | 1 + test/normalization/beta/IntegerB.dhallb | 1 + .../beta/IntegerNegativeA.dhallb | 1 + .../beta/IntegerNegativeB.dhallb | 1 + .../beta/IntegerPositiveA.dhallb | 1 + .../beta/IntegerPositiveB.dhallb | 1 + .../normalization/beta/IntegerShow-12A.dhallb | Bin 0 -> 25 bytes .../normalization/beta/IntegerShow-12B.dhallb | 1 + test/normalization/beta/IntegerShow12A.dhallb | Bin 0 -> 25 bytes test/normalization/beta/IntegerShow12B.dhallb | 1 + test/normalization/beta/IntegerShowA.dhallb | 1 + test/normalization/beta/IntegerShowB.dhallb | 1 + .../beta/IntegerToDouble-12A.dhallb | Bin 0 -> 29 bytes .../beta/IntegerToDouble-12B.dhallb | Bin 0 -> 10 bytes .../beta/IntegerToDouble12A.dhallb | Bin 0 -> 29 bytes .../beta/IntegerToDouble12B.dhallb | Bin 0 -> 10 bytes .../beta/IntegerToDoubleA.dhallb | 1 + .../beta/IntegerToDoubleB.dhallb | 1 + test/normalization/beta/LetA.dhallb | 1 + test/normalization/beta/LetB.dhallb | 1 + test/normalization/beta/LetWithTypeA.dhallb | 1 + test/normalization/beta/LetWithTypeB.dhallb | 1 + test/normalization/beta/MergeA.dhallb | Bin 0 -> 26 bytes test/normalization/beta/MergeB.dhallb | 1 + .../beta/MergeNormalizeArgumentsA.dhallb | 1 + .../beta/MergeNormalizeArgumentsB.dhallb | 1 + test/normalization/beta/MergeWithTypeA.dhallb | Bin 0 -> 28 bytes test/normalization/beta/MergeWithTypeB.dhallb | 1 + .../MergeWithTypeNormalizeArgumentsA.dhallb | 1 + .../MergeWithTypeNormalizeArgumentsB.dhallb | 1 + test/normalization/beta/RecordA.dhallb | 1 + test/normalization/beta/RecordB.dhallb | 1 + test/normalization/beta/RecordEmptyA.dhallb | 1 + test/normalization/beta/RecordEmptyB.dhallb | 1 + .../beta/RecordProjectionA.dhallb | 2 + .../beta/RecordProjectionB.dhallb | 1 + .../beta/RecordProjectionEmptyA.dhallb | 2 + .../beta/RecordProjectionEmptyB.dhallb | 1 + ...RecordProjectionNormalizeArgumentsA.dhallb | 2 + ...RecordProjectionNormalizeArgumentsB.dhallb | 2 + .../beta/RecordSelectionA.dhallb | 1 + .../beta/RecordSelectionB.dhallb | 1 + .../RecordSelectionNormalizeArgumentsA.dhallb | 1 + .../RecordSelectionNormalizeArgumentsB.dhallb | 1 + test/normalization/beta/RecordTypeA.dhallb | 1 + test/normalization/beta/RecordTypeB.dhallb | 1 + .../beta/RecordTypeEmptyA.dhallb | 1 + .../beta/RecordTypeEmptyB.dhallb | 1 + .../RecursiveRecordMergeCollisionA.dhallb | 1 + .../RecursiveRecordMergeCollisionB.dhallb | 1 + .../beta/RecursiveRecordMergeLhsEmptyA.dhallb | 1 + .../beta/RecursiveRecordMergeLhsEmptyB.dhallb | 1 + .../RecursiveRecordMergeNoCollisionA.dhallb | 1 + .../RecursiveRecordMergeNoCollisionB.dhallb | 1 + ...rsiveRecordMergeNormalizeArgumentsA.dhallb | 1 + ...rsiveRecordMergeNormalizeArgumentsB.dhallb | 1 + .../beta/RecursiveRecordMergeRhsEmptyA.dhallb | 1 + .../beta/RecursiveRecordMergeRhsEmptyB.dhallb | 1 + .../RecursiveRecordTypeMergeCollisionA.dhallb | 2 + .../RecursiveRecordTypeMergeCollisionB.dhallb | 1 + .../RecursiveRecordTypeMergeLhsEmptyA.dhallb | 2 + .../RecursiveRecordTypeMergeLhsEmptyB.dhallb | 1 + ...ecursiveRecordTypeMergeNoCollisionA.dhallb | 2 + ...ecursiveRecordTypeMergeNoCollisionB.dhallb | 1 + ...eRecordTypeMergeNormalizeArgumentsA.dhallb | 4 + ...eRecordTypeMergeNormalizeArgumentsB.dhallb | 2 + .../RecursiveRecordTypeMergeRhsEmptyA.dhallb | 2 + .../RecursiveRecordTypeMergeRhsEmptyB.dhallb | 1 + .../RightBiasedRecordMergeCollisionA.dhallb | 1 + .../RightBiasedRecordMergeCollisionB.dhallb | 1 + .../RightBiasedRecordMergeLhsEmptyA.dhallb | 1 + .../RightBiasedRecordMergeLhsEmptyB.dhallb | 1 + .../RightBiasedRecordMergeNoCollisionA.dhallb | 1 + .../RightBiasedRecordMergeNoCollisionB.dhallb | 1 + ...iasedRecordMergeNormalizeArgumentsA.dhallb | 1 + ...iasedRecordMergeNormalizeArgumentsB.dhallb | 1 + .../RightBiasedRecordMergeRhsEmptyA.dhallb | 1 + .../RightBiasedRecordMergeRhsEmptyB.dhallb | 1 + .../normalization/beta/TypeAnnotationA.dhallb | 1 + .../normalization/beta/TypeAnnotationB.dhallb | 1 + .../beta/UnionNormalizeAlternativesA.dhallb | 1 + .../beta/UnionNormalizeAlternativesB.dhallb | 1 + .../beta/UnionNormalizeArgumentsA.dhallb | 1 + .../beta/UnionNormalizeArgumentsB.dhallb | 1 + .../beta/UnionProjectConstructorA.dhallb | 1 + .../beta/UnionProjectConstructorB.dhallb | 1 + ...ojectConstructorNormalizeArgumentsA.dhallb | 1 + ...ojectConstructorNormalizeArgumentsB.dhallb | 1 + .../beta/UnionSortAlternativesA.dhallb | 1 + .../beta/UnionSortAlternativesB.dhallb | 1 + test/normalization/beta/UnionTypeA.dhallb | 1 + test/normalization/beta/UnionTypeB.dhallb | 1 + .../normalization/beta/UnionTypeEmptyA.dhallb | 1 + .../normalization/beta/UnionTypeEmptyB.dhallb | 1 + .../beta/UnionTypeNormalizeArgumentsA.dhallb | 1 + .../beta/UnionTypeNormalizeArgumentsB.dhallb | 1 + 108 files changed, 471 insertions(+), 101 deletions(-) create mode 100644 test/normalization/beta/DoubleA.dhallb create mode 100644 test/normalization/beta/DoubleB.dhallb create mode 100644 test/normalization/beta/DoubleLiteralA.dhallb create mode 100644 test/normalization/beta/DoubleLiteralB.dhallb create mode 100644 test/normalization/beta/DoubleShowA.dhallb create mode 100644 test/normalization/beta/DoubleShowB.dhallb create mode 100644 test/normalization/beta/DoubleShowValueA.dhallb create mode 100644 test/normalization/beta/DoubleShowValueB.dhallb create mode 100644 test/normalization/beta/IntegerA.dhallb create mode 100644 test/normalization/beta/IntegerB.dhallb create mode 100644 test/normalization/beta/IntegerNegativeA.dhallb create mode 100644 test/normalization/beta/IntegerNegativeB.dhallb create mode 100644 test/normalization/beta/IntegerPositiveA.dhallb create mode 100644 test/normalization/beta/IntegerPositiveB.dhallb create mode 100644 test/normalization/beta/IntegerShow-12A.dhallb create mode 100644 test/normalization/beta/IntegerShow-12B.dhallb create mode 100644 test/normalization/beta/IntegerShow12A.dhallb create mode 100644 test/normalization/beta/IntegerShow12B.dhallb create mode 100644 test/normalization/beta/IntegerShowA.dhallb create mode 100644 test/normalization/beta/IntegerShowB.dhallb create mode 100644 test/normalization/beta/IntegerToDouble-12A.dhallb create mode 100644 test/normalization/beta/IntegerToDouble-12B.dhallb create mode 100644 test/normalization/beta/IntegerToDouble12A.dhallb create mode 100644 test/normalization/beta/IntegerToDouble12B.dhallb create mode 100644 test/normalization/beta/IntegerToDoubleA.dhallb create mode 100644 test/normalization/beta/IntegerToDoubleB.dhallb create mode 100644 test/normalization/beta/LetA.dhallb create mode 100644 test/normalization/beta/LetB.dhallb create mode 100644 test/normalization/beta/LetWithTypeA.dhallb create mode 100644 test/normalization/beta/LetWithTypeB.dhallb create mode 100644 test/normalization/beta/MergeA.dhallb create mode 100644 test/normalization/beta/MergeB.dhallb create mode 100644 test/normalization/beta/MergeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/MergeNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/MergeWithTypeA.dhallb create mode 100644 test/normalization/beta/MergeWithTypeB.dhallb create mode 100644 test/normalization/beta/MergeWithTypeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/MergeWithTypeNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RecordA.dhallb create mode 100644 test/normalization/beta/RecordB.dhallb create mode 100644 test/normalization/beta/RecordEmptyA.dhallb create mode 100644 test/normalization/beta/RecordEmptyB.dhallb create mode 100644 test/normalization/beta/RecordProjectionA.dhallb create mode 100644 test/normalization/beta/RecordProjectionB.dhallb create mode 100644 test/normalization/beta/RecordProjectionEmptyA.dhallb create mode 100644 test/normalization/beta/RecordProjectionEmptyB.dhallb create mode 100644 test/normalization/beta/RecordProjectionNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/RecordProjectionNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RecordSelectionA.dhallb create mode 100644 test/normalization/beta/RecordSelectionB.dhallb create mode 100644 test/normalization/beta/RecordSelectionNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/RecordSelectionNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RecordTypeA.dhallb create mode 100644 test/normalization/beta/RecordTypeB.dhallb create mode 100644 test/normalization/beta/RecordTypeEmptyA.dhallb create mode 100644 test/normalization/beta/RecordTypeEmptyB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeCollisionA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeCollisionB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeLhsEmptyA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeLhsEmptyB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeNoCollisionA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeNoCollisionB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeRhsEmptyA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordMergeRhsEmptyB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeCollisionA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeCollisionB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeNoCollisionA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeNoCollisionB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyA.dhallb create mode 100644 test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyB.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeCollisionA.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeCollisionB.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeLhsEmptyA.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeLhsEmptyB.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeNoCollisionA.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeNoCollisionB.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeRhsEmptyA.dhallb create mode 100644 test/normalization/beta/RightBiasedRecordMergeRhsEmptyB.dhallb create mode 100644 test/normalization/beta/TypeAnnotationA.dhallb create mode 100644 test/normalization/beta/TypeAnnotationB.dhallb create mode 100644 test/normalization/beta/UnionNormalizeAlternativesA.dhallb create mode 100644 test/normalization/beta/UnionNormalizeAlternativesB.dhallb create mode 100644 test/normalization/beta/UnionNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/UnionNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/UnionProjectConstructorA.dhallb create mode 100644 test/normalization/beta/UnionProjectConstructorB.dhallb create mode 100644 test/normalization/beta/UnionProjectConstructorNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/UnionProjectConstructorNormalizeArgumentsB.dhallb create mode 100644 test/normalization/beta/UnionSortAlternativesA.dhallb create mode 100644 test/normalization/beta/UnionSortAlternativesB.dhallb create mode 100644 test/normalization/beta/UnionTypeA.dhallb create mode 100644 test/normalization/beta/UnionTypeB.dhallb create mode 100644 test/normalization/beta/UnionTypeEmptyA.dhallb create mode 100644 test/normalization/beta/UnionTypeEmptyB.dhallb create mode 100644 test/normalization/beta/UnionTypeNormalizeArgumentsA.dhallb create mode 100644 test/normalization/beta/UnionTypeNormalizeArgumentsB.dhallb diff --git a/lib/dhall/ast.rb b/lib/dhall/ast.rb index 2c54dee..28e8ca6 100644 --- a/lib/dhall/ast.rb +++ b/lib/dhall/ast.rb @@ -21,6 +21,14 @@ module Dhall method(:call).to_proc end + def fetch(k) + RecordSelection.new(record: self, selector: k) + end + + def slice(*keys) + RecordProjection.new(record: self, selectors: keys) + end + def +(other) Operator::Plus.new(lhs: self, rhs: other) end @@ -71,6 +79,33 @@ module Dhall Operator::Equal.new(lhs: self, rhs: other) end end + + def deep_merge(other) + case other + when EmptyRecord + other.deep_merge(self) + else + Operator::RecursiveRecordMerge.new(lhs: self, rhs: other) + end + end + + def merge(other) + case other + when EmptyRecord + other.merge(self) + else + Operator::RightBiasedRecordMerge.new(lhs: self, rhs: other) + end + end + + def deep_merge_type(other) + case other + when EmptyRecordType + other.deep_merge_type(self) + else + Operator::RecursiveRecordTypeMerge.new(lhs: self, rhs: other) + end + end end class Application < Expression @@ -85,14 +120,14 @@ module Dhall end class Function < Expression - def initialize(var, type, body) - @var = var - @type = type - @body = body - end + include(ValueSemantics.for_attributes do + var ::String + type Either(nil, Expression) # nil is not allowed in proper Dhall + body Expression + end) def map_subexpressions(&block) - self.class.new(@var, block[@type], block[@body]) + with(var: var, type: type.nil? ? nil : block[type], body: block[body]) end end @@ -145,9 +180,9 @@ module Dhall class Times < Operator; end class TextConcatenate < Operator; end class ListConcatenate < Operator; end - class RecordMerge < Operator; end - class RecordOverride < Operator; end - class RecordTypeMerge < Operator; end + class RecursiveRecordMerge < Operator; end + class RightBiasedRecordMerge < Operator; end + class RecursiveRecordTypeMerge < Operator; end class ImportFallback < Operator; end end @@ -257,14 +292,18 @@ module Dhall end class Merge < Expression - def initialize(record, input, type) - @record = record - @input = input - @type = type - end + include(ValueSemantics.for_attributes do + record Expression + input Expression + type Either(Expression, nil) + end) def map_subexpressions(&block) - self.class.new(block[@record], block[@input], block[@type]) + with( + record: block[record], + input: block[input], + type: type.nil? ? nil : block[type] + ) end end @@ -272,19 +311,39 @@ module Dhall attr_reader :record def initialize(record) + raise ArgumentError, "You meant EmptyRecordType?" if record.empty? @record = record end def map_subexpressions(&block) - self.class.new( - Hash[*@record.map { |k, v| [k, block[v]] }], - block[@input], - block[@type] - ) + self.class.new(Hash[*@record.map { |k, v| [k, block[v]] }]) + end + + def deep_merge_type(other) + return super unless other.is_a?(RecordType) + self.class.new(Hash[record.merge(other.record) { |_, v1, v2| + v1.deep_merge_type(v2) + }.sort]) + end + + def ==(other) + other.respond_to?(:record) && record.to_a == other.record.to_a end def eql?(other) - record == other.record + self == other + end + end + + class EmptyRecordType < Expression + include ValueSemantics.for_attributes { } + + def map_subexpressions + self + end + + def deep_merge_type(other) + other end end @@ -292,6 +351,7 @@ module Dhall attr_reader :record def initialize(record) + raise ArgumentError, "You meant EmptyRecord?" if record.empty? @record = record end @@ -299,63 +359,139 @@ module Dhall self.class.new(Hash[*@record.map { |k, v| [k, block[v]] }]) end + def fetch(k, default=nil, &block) + record.fetch(k, *default, &block) + end + + def slice(*keys) + if record.respond_to?(:slice) + self.class.new(record.slice(*keys)) + else + self.class.new(record.select { |k, _| keys.include?(k) }) + end + end + + def deep_merge(other) + return super unless other.is_a?(Record) + self.class.new(Hash[record.merge(other.record) { |_, v1, v2| + v1.deep_merge(v2) + }.sort]) + end + + def merge(other) + return super unless other.is_a?(Record) + self.class.new(Hash[record.merge(other.record).sort]) + end + + def ==(other) + other.respond_to?(:record) && record.to_a == other.record.to_a + end + def eql?(other) - record == other.record + self == other end end - class RecordFieldAccess < Expression - def initialize(record, field) - raise TypeError, "field must be a String" unless field.is_a?(String) + class EmptyRecord < Expression + include ValueSemantics.for_attributes { } - @record = record - @field = field + def map_subexpressions + self + end + + def fetch(k, default=nil, &block) + {}.fetch(k, *default, &block) + end + + def slice(*) + self + end + + def deep_merge(other) + other end + def merge(other) + other + end + end + + class RecordSelection < Expression + include(ValueSemantics.for_attributes do + record Expression + selector ::String + end) + def map_subexpressions(&block) - self.class.new(Hash[*@record.map { |k, v| [k, block[v]] }], @field) + with(record: block[record], selector: selector) end end class RecordProjection < Expression - def initialize(record, *fields) - unless fields.all? { |x| x.is_a?(String) } - raise TypeError, "fields must be String" - end + include(ValueSemantics.for_attributes do + record Expression + selectors Util::ArrayOf.new(::String, min: 1) + end) - @record = record - @fields = fields + def map_subexpressions(&block) + with(record: block[record], selectors: selectors) end + end + + class EmptyRecordProjection < Expression + include(ValueSemantics.for_attributes do + record Expression + end) def map_subexpressions(&block) - self.class.new(Hash[*@record.map { |k, v| [k, block[v]] }], @fields) + with(record: block[record]) end end class UnionType < Expression + attr_reader :record + def initialize(record) @record = record end def map_subexpressions(&block) - self.class.new(Hash[*@record.map { |k, v| [k, block[v]] }]) + self.class.new(Hash[@record.map { |k, v| [k, block[v]] }]) end - end - class Union < Expression - def initialize(tag, value, rest_of_type) - raise TypeError, "tag must be a string" unless tag.is_a?(String) + def ==(other) + other.respond_to?(:record) && record.to_a == other.record.to_a + end - @tag = tag - @value = value - @rest_of_type = rest_of_type + def eql?(other) + self == other + end + + def fetch(k) + Function.new( + var: k, + type: record.fetch(k), + body: Union.new( + tag: k, + value: Variable.new(name: k), + alternatives: self.class.new(record.dup.tap { |r| r.delete(k) }) + ) + ) end + end + + class Union < Expression + include(ValueSemantics.for_attributes do + tag ::String + value Expression + alternatives UnionType + end) def map_subexpressions(&block) - self.class.new( - @tag, - block[@value], - Hash[*@rest_of_type.map { |k, v| [k, block[v]] }] + with( + tag: tag, + value: block[value], + alternatives: block[alternatives] ) end end @@ -436,12 +572,20 @@ module Dhall include(ValueSemantics.for_attributes do value ::Integer end) + + def to_s + "#{value >= 0 ? "+" : ""}#{value.to_s}" + end end class Double < Number include(ValueSemantics.for_attributes do value ::Float end) + + def to_s + value.to_s + end end class Text < Expression @@ -516,43 +660,46 @@ module Dhall end class Let - def initialize(var, assign, type=nil) - @var = var - @assign = assign - @type = type - end + include(ValueSemantics.for_attributes do + var ::String + assign Expression + type Either(nil, Expression) + end) def map_subexpressions(&block) - self.class.new(@var, block[@assign], block[@type]) + with( + var: var, + assign: block[assign], + type: type.nil? ? nil : block[type] + ) end end class LetBlock < Expression - def initialize(body, *lets) - unless lets.all? { |x| x.is_a?(Let) } - raise TypeError, "LetBlock only contains Let" - end - - @lets = lets - @body = body - end + include(ValueSemantics.for_attributes do + lets ArrayOf(Let) + body Expression + end) def map_subexpressions(&block) - self.class.new( - block[@body], - *@lets.map { |let| let.map_subexpressions(&block) } + with( + body: block[body], + lets: lets.map { |let| let.map_subexpressions(&block) } ) end end class TypeAnnotation < Expression - def initialize(value, type) - @value = value - @type = type - end + include(ValueSemantics.for_attributes do + value Expression + type Expression + end) def map_subexpressions(&block) - self.class.new(block[@value], block[@type]) + with( + value: block[value], + type: block[type] + ) end end end diff --git a/lib/dhall/binary.rb b/lib/dhall/binary.rb index 8f83534..799c33b 100644 --- a/lib/dhall/binary.rb +++ b/lib/dhall/binary.rb @@ -43,15 +43,19 @@ module Dhall class Function def self.decode(var_or_type, type_or_body, body_or_nil=nil) if body_or_nil.nil? - new("_", Dhall.decode(var_or_type), Dhall.decode(type_or_body)) + new( + var: "_", + type: Dhall.decode(var_or_type), + body: Dhall.decode(type_or_body) + ) else - unless var_or_type.is_a?(String) - raise TypeError, "Function var must be a String" - end - raise ArgumentError, "explicit var named _" if var_or_type == "_" - new(var_or_type, Dhall.decode(type_or_body), Dhall.decode(body_or_nil)) + new( + var: var_or_type, + type: Dhall.decode(type_or_body), + body: Dhall.decode(body_or_nil) + ) end end end @@ -61,7 +65,7 @@ module Dhall Or, And, Equal, NotEqual, Plus, Times, TextConcatenate, ListConcatenate, - RecordMerge, RecordOverride, RecordTypeMerge, + RecursiveRecordMerge, RightBiasedRecordMerge, RecursiveRecordTypeMerge, ImportFallback ].freeze @@ -99,34 +103,46 @@ module Dhall class Merge def self.decode(record, input, type=nil) new( - Dhall.decode(record), - Dhall.decode(input), - type.nil? ? nil : Dhall.decode(type) + record: Dhall.decode(record), + input: Dhall.decode(input), + type: type.nil? ? nil : Dhall.decode(type) ) end end class RecordType def self.decode(record) - new(Hash[record.map { |k, v| [k, Dhall.decode(v)] }]) + if record.empty? + EmptyRecordType.new + else + new(Hash[record.map { |k, v| [k, Dhall.decode(v)] }]) + end end end class Record def self.decode(record) - new(Hash[record.map { |k, v| [k, Dhall.decode(v)] }]) + if record.empty? + EmptyRecord.new + else + new(Hash[record.map { |k, v| [k, Dhall.decode(v)] }]) + end end end - class RecordFieldAccess - def self.decode(record, field) - new(Dhall.decode(record), field) + class RecordSelection + def self.decode(record, selector) + new(record: Dhall.decode(record), selector: selector) end end class RecordProjection - def self.decode(record, *fields) - new(Dhall.decode(record), *fields) + def self.decode(record, *selectors) + if selectors.empty? + EmptyRecordProjection.new(record: Dhall.decode(record)) + else + new(record: Dhall.decode(record), selectors: selectors) + end end end @@ -137,11 +153,11 @@ module Dhall end class Union - def self.decode(tag, value, rest_of_type) + def self.decode(tag, value, alternatives) new( - tag, - Dhall.decode(value), - Hash[rest_of_type.map { |k, v| [k, Dhall.decode(v)] }] + tag: tag, + value: Dhall.decode(value), + alternatives: UnionType.decode(alternatives) ) end end @@ -190,12 +206,12 @@ module Dhall class LetBlock def self.decode(*parts) new( - Dhall.decode(parts.pop), - *parts.each_slice(3).map do |(var, type, assign)| + body: Dhall.decode(parts.pop), + lets: parts.each_slice(3).map do |(var, type, assign)| Let.new( - var, - Dhall.decode(assign), - type.nil? ? nil : Dhall.decode(type) + var: var, + assign: Dhall.decode(assign), + type: type.nil? ? nil : Dhall.decode(type) ) end ) @@ -204,7 +220,7 @@ module Dhall class TypeAnnotation def self.decode(value, type) - new(Dhall.decode(value), Dhall.decode(type)) + new(value: Dhall.decode(value), type: Dhall.decode(type)) end end @@ -235,7 +251,7 @@ module Dhall Merge, RecordType, Record, - RecordFieldAccess, + RecordSelection, RecordProjection, UnionType, Union, diff --git a/lib/dhall/builtins.rb b/lib/dhall/builtins.rb index 1f63261..8d27f9b 100644 --- a/lib/dhall/builtins.rb +++ b/lib/dhall/builtins.rb @@ -19,6 +19,36 @@ module Dhall module Builtins # rubocop:disable Style/ClassAndModuleCamelCase + class Double_show < Builtin + def call(arg) + if arg.is_a?(Double) + Text.new(value: "\"#{arg.to_s}\"") + else + super + end + end + end + + class Integer_show < Builtin + def call(arg) + if arg.is_a?(Integer) + Text.new(value: "\"#{arg.to_s}\"") + else + super + end + end + end + + class Integer_toDouble < Builtin + def call(arg) + if arg.is_a?(Integer) + Double.new(value: arg.value.to_f) + else + super + end + end + end + class Natural_build < Builtin def fusion(arg, *bogus) if bogus.empty? && @@ -35,9 +65,9 @@ module Dhall arg.call( Variable.new(name: "Natural"), Function.new( - "_", - Variable.new(name: "Natural"), - Operator::Plus.new( + var: "_", + type: Variable.new(name: "Natural"), + body: Operator::Plus.new( lhs: Variable.new(name: "_"), rhs: Natural.new(value: 1) ) diff --git a/lib/dhall/normalize.rb b/lib/dhall/normalize.rb index ed5e4ff..89afda7 100644 --- a/lib/dhall/normalize.rb +++ b/lib/dhall/normalize.rb @@ -126,6 +126,24 @@ module Dhall lhs.normalize.concat(rhs.normalize) end end + + class RecursiveRecordMerge + def normalize + lhs.normalize.deep_merge(rhs.normalize) + end + end + + class RightBiasedRecordMerge + def normalize + lhs.normalize.merge(rhs.normalize) + end + end + + class RecursiveRecordTypeMerge + def normalize + lhs.normalize.deep_merge_type(rhs.normalize) + end + end end class List @@ -141,21 +159,58 @@ module Dhall end class Merge + def normalize + normalized = super + if normalized.record.is_a?(Record) && normalized.input.is_a?(Union) + normalized.record.fetch(normalized.input.tag).call( + normalized.input.value + ) + else + normalized + end + end end class RecordType + def normalize + self.class.new(Hash[record.sort.map { |(k, v)| [k, v.normalize] }]) + end end class Record + def normalize + self.class.new(Hash[record.sort.map { |(k, v)| [k, v.normalize] }]) + end + end + + class EmptyRecord + def normalize + self + end end - class RecordFieldAccess + class RecordSelection + def normalize + record.normalize.fetch(selector) + end end class RecordProjection + def normalize + record.normalize.slice(*selectors) + end + end + + class EmptyRecordProjection + def normalize + EmptyRecord.new + end end class UnionType + def normalize + self.class.new(Hash[super.record.sort]) + end end class Union @@ -218,8 +273,23 @@ module Dhall end class LetBlock + def normalize + lets.reduce(body) { |inside, let| + Application.new( + function: Function.new( + var: let.var, + type: let.type, + body: inside + ), + arguments: [let.assign] + ) + }.normalize + end end class TypeAnnotation + def normalize + value.normalize + end end end diff --git a/test/normalization/beta/DoubleA.dhallb b/test/normalization/beta/DoubleA.dhallb new file mode 100644 index 0000000..8e3e6b4 --- /dev/null +++ b/test/normalization/beta/DoubleA.dhallb @@ -0,0 +1 @@ +‚e5.0.0fDouble \ No newline at end of file diff --git a/test/normalization/beta/DoubleB.dhallb b/test/normalization/beta/DoubleB.dhallb new file mode 100644 index 0000000..8e3e6b4 --- /dev/null +++ b/test/normalization/beta/DoubleB.dhallb @@ -0,0 +1 @@ +‚e5.0.0fDouble \ No newline at end of file diff --git a/test/normalization/beta/DoubleLiteralA.dhallb b/test/normalization/beta/DoubleLiteralA.dhallb new file mode 100644 index 0000000..461f1b0 --- /dev/null +++ b/test/normalization/beta/DoubleLiteralA.dhallb @@ -0,0 +1 @@ +‚e5.0.0û?ó333333 \ No newline at end of file diff --git a/test/normalization/beta/DoubleLiteralB.dhallb b/test/normalization/beta/DoubleLiteralB.dhallb new file mode 100644 index 0000000..461f1b0 --- /dev/null +++ b/test/normalization/beta/DoubleLiteralB.dhallb @@ -0,0 +1 @@ +‚e5.0.0û?ó333333 \ No newline at end of file diff --git a/test/normalization/beta/DoubleShowA.dhallb b/test/normalization/beta/DoubleShowA.dhallb new file mode 100644 index 0000000..b7068fb --- /dev/null +++ b/test/normalization/beta/DoubleShowA.dhallb @@ -0,0 +1 @@ +‚e5.0.0kDouble/show \ No newline at end of file diff --git a/test/normalization/beta/DoubleShowB.dhallb b/test/normalization/beta/DoubleShowB.dhallb new file mode 100644 index 0000000..b7068fb --- /dev/null +++ b/test/normalization/beta/DoubleShowB.dhallb @@ -0,0 +1 @@ +‚e5.0.0kDouble/show \ No newline at end of file diff --git a/test/normalization/beta/DoubleShowValueA.dhallb b/test/normalization/beta/DoubleShowValueA.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..d0fa2c9fb045be68cfb7eb1916b1392d7d5ead8e GIT binary patch literal 30 hcmZolHPtiFGiYYWcF8YI%1PBP&d4wSZU5OA3;>-X3UL4c literal 0 HcmV?d00001 diff --git a/test/normalization/beta/DoubleShowValueB.dhallb b/test/normalization/beta/DoubleShowValueB.dhallb new file mode 100644 index 0000000..70d086f --- /dev/null +++ b/test/normalization/beta/DoubleShowValueB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚e"1.2" \ No newline at end of file diff --git a/test/normalization/beta/IntegerA.dhallb b/test/normalization/beta/IntegerA.dhallb new file mode 100644 index 0000000..8e61d16 --- /dev/null +++ b/test/normalization/beta/IntegerA.dhallb @@ -0,0 +1 @@ +‚e5.0.0gInteger \ No newline at end of file diff --git a/test/normalization/beta/IntegerB.dhallb b/test/normalization/beta/IntegerB.dhallb new file mode 100644 index 0000000..8e61d16 --- /dev/null +++ b/test/normalization/beta/IntegerB.dhallb @@ -0,0 +1 @@ +‚e5.0.0gInteger \ No newline at end of file diff --git a/test/normalization/beta/IntegerNegativeA.dhallb b/test/normalization/beta/IntegerNegativeA.dhallb new file mode 100644 index 0000000..5cca81b --- /dev/null +++ b/test/normalization/beta/IntegerNegativeA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ \ No newline at end of file diff --git a/test/normalization/beta/IntegerNegativeB.dhallb b/test/normalization/beta/IntegerNegativeB.dhallb new file mode 100644 index 0000000..5cca81b --- /dev/null +++ b/test/normalization/beta/IntegerNegativeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ \ No newline at end of file diff --git a/test/normalization/beta/IntegerPositiveA.dhallb b/test/normalization/beta/IntegerPositiveA.dhallb new file mode 100644 index 0000000..f66692d --- /dev/null +++ b/test/normalization/beta/IntegerPositiveA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ \ No newline at end of file diff --git a/test/normalization/beta/IntegerPositiveB.dhallb b/test/normalization/beta/IntegerPositiveB.dhallb new file mode 100644 index 0000000..f66692d --- /dev/null +++ b/test/normalization/beta/IntegerPositiveB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ \ No newline at end of file diff --git a/test/normalization/beta/IntegerShow-12A.dhallb b/test/normalization/beta/IntegerShow-12A.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..5d14605a464ce23f1643753bba49b6e749e2ca16 GIT binary patch literal 25 gcmZolHPtiFGiYYW@yshpO;0V-FV4s>ZxYZ30BAV~LjV8( literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerShow-12B.dhallb b/test/normalization/beta/IntegerShow-12B.dhallb new file mode 100644 index 0000000..26efcb3 --- /dev/null +++ b/test/normalization/beta/IntegerShow-12B.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚e"-12" \ No newline at end of file diff --git a/test/normalization/beta/IntegerShow12A.dhallb b/test/normalization/beta/IntegerShow12A.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..10c1d3921bdfe5e9b3b278ca70005a307b5d0dd5 GIT binary patch literal 25 gcmZolHPtiFGiYYW@yshpO;0V-FV4s>ZxY}E0B9NrBme*a literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerShow12B.dhallb b/test/normalization/beta/IntegerShow12B.dhallb new file mode 100644 index 0000000..cd8ca0b --- /dev/null +++ b/test/normalization/beta/IntegerShow12B.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚e"+12" \ No newline at end of file diff --git a/test/normalization/beta/IntegerShowA.dhallb b/test/normalization/beta/IntegerShowA.dhallb new file mode 100644 index 0000000..9307fa7 --- /dev/null +++ b/test/normalization/beta/IntegerShowA.dhallb @@ -0,0 +1 @@ +‚e5.0.0lInteger/show \ No newline at end of file diff --git a/test/normalization/beta/IntegerShowB.dhallb b/test/normalization/beta/IntegerShowB.dhallb new file mode 100644 index 0000000..9307fa7 --- /dev/null +++ b/test/normalization/beta/IntegerShowB.dhallb @@ -0,0 +1 @@ +‚e5.0.0lInteger/show \ No newline at end of file diff --git a/test/normalization/beta/IntegerToDouble-12A.dhallb b/test/normalization/beta/IntegerToDouble-12A.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..ec627642dd342922a7d658471cbff5c90ec24df9 GIT binary patch literal 29 kcmZolHPtiFGiYWg@XRYoO;0V-FUfbwFHOoxZ4%H10FGV>!~g&Q literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerToDouble-12B.dhallb b/test/normalization/beta/IntegerToDouble-12B.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..74c08b9373f70d8802097d9f50d5b1360dcdbc61 GIT binary patch literal 10 RcmZolHPtiFGx&Lm0RR%(1DpT= literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerToDouble12A.dhallb b/test/normalization/beta/IntegerToDouble12A.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..ebf5e067c642f946e2d18da83864002f2c9cef4e GIT binary patch literal 29 kcmZolHPtiFGiYWg@XRYoO;0V-FUfbwFHOoxZ4%%C0FFNir2qf` literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerToDouble12B.dhallb b/test/normalization/beta/IntegerToDouble12B.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..da98dd21c284221aba9cbcff987c00e254e99f36 GIT binary patch literal 10 RcmZolHPtiFGx+Jn000r%0~`PV literal 0 HcmV?d00001 diff --git a/test/normalization/beta/IntegerToDoubleA.dhallb b/test/normalization/beta/IntegerToDoubleA.dhallb new file mode 100644 index 0000000..c45797d --- /dev/null +++ b/test/normalization/beta/IntegerToDoubleA.dhallb @@ -0,0 +1 @@ +‚e5.0.0pInteger/toDouble \ No newline at end of file diff --git a/test/normalization/beta/IntegerToDoubleB.dhallb b/test/normalization/beta/IntegerToDoubleB.dhallb new file mode 100644 index 0000000..c45797d --- /dev/null +++ b/test/normalization/beta/IntegerToDoubleB.dhallb @@ -0,0 +1 @@ +‚e5.0.0pInteger/toDouble \ No newline at end of file diff --git a/test/normalization/beta/LetA.dhallb b/test/normalization/beta/LetA.dhallb new file mode 100644 index 0000000..203d6d2 --- /dev/null +++ b/test/normalization/beta/LetA.dhallb @@ -0,0 +1 @@ +‚e5.0.0…axöayax \ No newline at end of file diff --git a/test/normalization/beta/LetB.dhallb b/test/normalization/beta/LetB.dhallb new file mode 100644 index 0000000..590caa2 --- /dev/null +++ b/test/normalization/beta/LetB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ay \ No newline at end of file diff --git a/test/normalization/beta/LetWithTypeA.dhallb b/test/normalization/beta/LetWithTypeA.dhallb new file mode 100644 index 0000000..72bd684 --- /dev/null +++ b/test/normalization/beta/LetWithTypeA.dhallb @@ -0,0 +1 @@ +‚e5.0.0…axaAayax \ No newline at end of file diff --git a/test/normalization/beta/LetWithTypeB.dhallb b/test/normalization/beta/LetWithTypeB.dhallb new file mode 100644 index 0000000..590caa2 --- /dev/null +++ b/test/normalization/beta/LetWithTypeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ay \ No newline at end of file diff --git a/test/normalization/beta/MergeA.dhallb b/test/normalization/beta/MergeA.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..3d51249878614bb856d45d7789262b91c15ac25a GIT binary patch literal 26 hcmZolHPtiFGiYXO;#ini(af0W$k4)*Sdmz{003&I2yXxY literal 0 HcmV?d00001 diff --git a/test/normalization/beta/MergeB.dhallb b/test/normalization/beta/MergeB.dhallb new file mode 100644 index 0000000..590caa2 --- /dev/null +++ b/test/normalization/beta/MergeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ay \ No newline at end of file diff --git a/test/normalization/beta/MergeNormalizeArgumentsA.dhallb b/test/normalization/beta/MergeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..8bcce4a --- /dev/null +++ b/test/normalization/beta/MergeNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ„õaxay„õazab \ No newline at end of file diff --git a/test/normalization/beta/MergeNormalizeArgumentsB.dhallb b/test/normalization/beta/MergeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..5ce0ede --- /dev/null +++ b/test/normalization/beta/MergeNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒaxaz \ No newline at end of file diff --git a/test/normalization/beta/MergeWithTypeA.dhallb b/test/normalization/beta/MergeWithTypeA.dhallb new file mode 100644 index 0000000000000000000000000000000000000000..c5422914506504e477a6704bc16aada4630e966c GIT binary patch literal 28 jcmZolHPtiFGiYIJ;#ini(af0W$k4)*Sdmz{Akh&3e4Pmr literal 0 HcmV?d00001 diff --git a/test/normalization/beta/MergeWithTypeB.dhallb b/test/normalization/beta/MergeWithTypeB.dhallb new file mode 100644 index 0000000..590caa2 --- /dev/null +++ b/test/normalization/beta/MergeWithTypeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ay \ No newline at end of file diff --git a/test/normalization/beta/MergeWithTypeNormalizeArgumentsA.dhallb b/test/normalization/beta/MergeWithTypeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..1c41db2 --- /dev/null +++ b/test/normalization/beta/MergeWithTypeNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„„õaxay„õazab„õaXaY \ No newline at end of file diff --git a/test/normalization/beta/MergeWithTypeNormalizeArgumentsB.dhallb b/test/normalization/beta/MergeWithTypeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..1e28165 --- /dev/null +++ b/test/normalization/beta/MergeWithTypeNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„axazaX \ No newline at end of file diff --git a/test/normalization/beta/RecordA.dhallb b/test/normalization/beta/RecordA.dhallb new file mode 100644 index 0000000..9f7a406 --- /dev/null +++ b/test/normalization/beta/RecordA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢abaxaa„õayaz \ No newline at end of file diff --git a/test/normalization/beta/RecordB.dhallb b/test/normalization/beta/RecordB.dhallb new file mode 100644 index 0000000..b2f2a7c --- /dev/null +++ b/test/normalization/beta/RecordB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢aaayabax \ No newline at end of file diff --git a/test/normalization/beta/RecordEmptyA.dhallb b/test/normalization/beta/RecordEmptyA.dhallb new file mode 100644 index 0000000..7c2938f --- /dev/null +++ b/test/normalization/beta/RecordEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚  \ No newline at end of file diff --git a/test/normalization/beta/RecordEmptyB.dhallb b/test/normalization/beta/RecordEmptyB.dhallb new file mode 100644 index 0000000..7c2938f --- /dev/null +++ b/test/normalization/beta/RecordEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚  \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionA.dhallb b/test/normalization/beta/RecordProjectionA.dhallb new file mode 100644 index 0000000..686f9d9 --- /dev/null +++ b/test/normalization/beta/RecordProjectionA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +‚£axaaayabazacaxaz \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionB.dhallb b/test/normalization/beta/RecordProjectionB.dhallb new file mode 100644 index 0000000..49725b5 --- /dev/null +++ b/test/normalization/beta/RecordProjectionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢axaaazac \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionEmptyA.dhallb b/test/normalization/beta/RecordProjectionEmptyA.dhallb new file mode 100644 index 0000000..80a9300 --- /dev/null +++ b/test/normalization/beta/RecordProjectionEmptyA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0‚ +ax \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionEmptyB.dhallb b/test/normalization/beta/RecordProjectionEmptyB.dhallb new file mode 100644 index 0000000..7c2938f --- /dev/null +++ b/test/normalization/beta/RecordProjectionEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚  \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionNormalizeArgumentsA.dhallb b/test/normalization/beta/RecordProjectionNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..27d0b3f --- /dev/null +++ b/test/normalization/beta/RecordProjectionNormalizeArgumentsA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +„õayazaxay \ No newline at end of file diff --git a/test/normalization/beta/RecordProjectionNormalizeArgumentsB.dhallb b/test/normalization/beta/RecordProjectionNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..2c53875 --- /dev/null +++ b/test/normalization/beta/RecordProjectionNormalizeArgumentsB.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +ayaxay \ No newline at end of file diff --git a/test/normalization/beta/RecordSelectionA.dhallb b/test/normalization/beta/RecordSelectionA.dhallb new file mode 100644 index 0000000..c85d2e3 --- /dev/null +++ b/test/normalization/beta/RecordSelectionA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ ‚¡axavax \ No newline at end of file diff --git a/test/normalization/beta/RecordSelectionB.dhallb b/test/normalization/beta/RecordSelectionB.dhallb new file mode 100644 index 0000000..6a7e3ae --- /dev/null +++ b/test/normalization/beta/RecordSelectionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0av \ No newline at end of file diff --git a/test/normalization/beta/RecordSelectionNormalizeArgumentsA.dhallb b/test/normalization/beta/RecordSelectionNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..ca67664 --- /dev/null +++ b/test/normalization/beta/RecordSelectionNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ „õayazax \ No newline at end of file diff --git a/test/normalization/beta/RecordSelectionNormalizeArgumentsB.dhallb b/test/normalization/beta/RecordSelectionNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..072448d --- /dev/null +++ b/test/normalization/beta/RecordSelectionNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ ayax \ No newline at end of file diff --git a/test/normalization/beta/RecordTypeA.dhallb b/test/normalization/beta/RecordTypeA.dhallb new file mode 100644 index 0000000..7fffd74 --- /dev/null +++ b/test/normalization/beta/RecordTypeA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢abaTaa„õaAaB \ No newline at end of file diff --git a/test/normalization/beta/RecordTypeB.dhallb b/test/normalization/beta/RecordTypeB.dhallb new file mode 100644 index 0000000..d0183bc --- /dev/null +++ b/test/normalization/beta/RecordTypeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢aaaAabaT \ No newline at end of file diff --git a/test/normalization/beta/RecordTypeEmptyA.dhallb b/test/normalization/beta/RecordTypeEmptyA.dhallb new file mode 100644 index 0000000..ec73203 --- /dev/null +++ b/test/normalization/beta/RecordTypeEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚  \ No newline at end of file diff --git a/test/normalization/beta/RecordTypeEmptyB.dhallb b/test/normalization/beta/RecordTypeEmptyB.dhallb new file mode 100644 index 0000000..ec73203 --- /dev/null +++ b/test/normalization/beta/RecordTypeEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚  \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeCollisionA.dhallb b/test/normalization/beta/RecursiveRecordMergeCollisionA.dhallb new file mode 100644 index 0000000..4ec99a4 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeCollisionA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„‚¡ax‚¡az‚‚¡ax‚¡ay‚ \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeCollisionB.dhallb b/test/normalization/beta/RecursiveRecordMergeCollisionB.dhallb new file mode 100644 index 0000000..5d86eb6 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¡ax‚¢ay‚az‚ \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeLhsEmptyA.dhallb b/test/normalization/beta/RecursiveRecordMergeLhsEmptyA.dhallb new file mode 100644 index 0000000..c9d3bc7 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeLhsEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„‚ ax \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeLhsEmptyB.dhallb b/test/normalization/beta/RecursiveRecordMergeLhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeLhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeNoCollisionA.dhallb b/test/normalization/beta/RecursiveRecordMergeNoCollisionA.dhallb new file mode 100644 index 0000000..105bfa1 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeNoCollisionA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„‚¡ax‚¡az‚‚¡ab‚¡ay‚ \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeNoCollisionB.dhallb b/test/normalization/beta/RecursiveRecordMergeNoCollisionB.dhallb new file mode 100644 index 0000000..c5f89ef --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeNoCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢ab‚¡ay‚ax‚¡az‚ \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsA.dhallb b/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..51d8f11 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„„ax‚ „‚ ab \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsB.dhallb b/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..2c3eb64 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„axab \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeRhsEmptyA.dhallb b/test/normalization/beta/RecursiveRecordMergeRhsEmptyA.dhallb new file mode 100644 index 0000000..956642e --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeRhsEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ax‚  \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordMergeRhsEmptyB.dhallb b/test/normalization/beta/RecursiveRecordMergeRhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordMergeRhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeCollisionA.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeCollisionA.dhallb new file mode 100644 index 0000000..f6c60bc --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeCollisionA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +‚¡ax‚¡azaA‚¡ax‚¡ayaB \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeCollisionB.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeCollisionB.dhallb new file mode 100644 index 0000000..4129be5 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¡ax‚¢ayaBazaA \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyA.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyA.dhallb new file mode 100644 index 0000000..e88dbc5 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +‚ ax \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyB.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeLhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionA.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionA.dhallb new file mode 100644 index 0000000..1bad76a --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +‚¡ax‚¡azaA‚¡ab‚¡ayaB \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionB.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionB.dhallb new file mode 100644 index 0000000..9329b6f --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeNoCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢ab‚¡ayaBax‚¡azaA \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsA.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..53b4f15 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsA.dhallb @@ -0,0 +1,4 @@ +‚e5.0.0„ +„ +ax‚ „ +‚ ab \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsB.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..79976a1 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeNormalizeArgumentsB.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +axab \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyA.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyA.dhallb new file mode 100644 index 0000000..dcf94cf --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyA.dhallb @@ -0,0 +1,2 @@ +‚e5.0.0„ +ax‚  \ No newline at end of file diff --git a/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyB.dhallb b/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RecursiveRecordTypeMergeRhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeCollisionA.dhallb b/test/normalization/beta/RightBiasedRecordMergeCollisionA.dhallb new file mode 100644 index 0000000..7f4102d --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeCollisionA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ ‚¢ay‚ax‚‚¡ax‚ \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeCollisionB.dhallb b/test/normalization/beta/RightBiasedRecordMergeCollisionB.dhallb new file mode 100644 index 0000000..fb24675 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚¢ax‚ay‚ \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeLhsEmptyA.dhallb b/test/normalization/beta/RightBiasedRecordMergeLhsEmptyA.dhallb new file mode 100644 index 0000000..28e4917 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeLhsEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ ‚ ax \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeLhsEmptyB.dhallb b/test/normalization/beta/RightBiasedRecordMergeLhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeLhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeNoCollisionA.dhallb b/test/normalization/beta/RightBiasedRecordMergeNoCollisionA.dhallb new file mode 100644 index 0000000..6ed8074 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeNoCollisionA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ ‚¢ay‚ax‚‚¡aa‚ \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeNoCollisionB.dhallb b/test/normalization/beta/RightBiasedRecordMergeNoCollisionB.dhallb new file mode 100644 index 0000000..5973167 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeNoCollisionB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚£aa‚ax‚ay‚ \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsA.dhallb b/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..83eff0f --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ „ ax‚ „ ay‚  \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsB.dhallb b/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..25f1949 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeRhsEmptyA.dhallb b/test/normalization/beta/RightBiasedRecordMergeRhsEmptyA.dhallb new file mode 100644 index 0000000..8e2db08 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeRhsEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ ax‚  \ No newline at end of file diff --git a/test/normalization/beta/RightBiasedRecordMergeRhsEmptyB.dhallb b/test/normalization/beta/RightBiasedRecordMergeRhsEmptyB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/RightBiasedRecordMergeRhsEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/TypeAnnotationA.dhallb b/test/normalization/beta/TypeAnnotationA.dhallb new file mode 100644 index 0000000..5d3bb8a --- /dev/null +++ b/test/normalization/beta/TypeAnnotationA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒaxaA \ No newline at end of file diff --git a/test/normalization/beta/TypeAnnotationB.dhallb b/test/normalization/beta/TypeAnnotationB.dhallb new file mode 100644 index 0000000..0fca291 --- /dev/null +++ b/test/normalization/beta/TypeAnnotationB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ax \ No newline at end of file diff --git a/test/normalization/beta/UnionNormalizeAlternativesA.dhallb b/test/normalization/beta/UnionNormalizeAlternativesA.dhallb new file mode 100644 index 0000000..b647c26 --- /dev/null +++ b/test/normalization/beta/UnionNormalizeAlternativesA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay¡ay„õaXaY \ No newline at end of file diff --git a/test/normalization/beta/UnionNormalizeAlternativesB.dhallb b/test/normalization/beta/UnionNormalizeAlternativesB.dhallb new file mode 100644 index 0000000..c28e51b --- /dev/null +++ b/test/normalization/beta/UnionNormalizeAlternativesB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay¡ayaX \ No newline at end of file diff --git a/test/normalization/beta/UnionNormalizeArgumentsA.dhallb b/test/normalization/beta/UnionNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..29a15b1 --- /dev/null +++ b/test/normalization/beta/UnionNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ ax„õayaz  \ No newline at end of file diff --git a/test/normalization/beta/UnionNormalizeArgumentsB.dhallb b/test/normalization/beta/UnionNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..7c9179c --- /dev/null +++ b/test/normalization/beta/UnionNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay  \ No newline at end of file diff --git a/test/normalization/beta/UnionProjectConstructorA.dhallb b/test/normalization/beta/UnionProjectConstructorA.dhallb new file mode 100644 index 0000000..6106c25 --- /dev/null +++ b/test/normalization/beta/UnionProjectConstructorA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ ‚ ¡axaTax \ No newline at end of file diff --git a/test/normalization/beta/UnionProjectConstructorB.dhallb b/test/normalization/beta/UnionProjectConstructorB.dhallb new file mode 100644 index 0000000..bdd8967 --- /dev/null +++ b/test/normalization/beta/UnionProjectConstructorB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„axaT„ axax  \ No newline at end of file diff --git a/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsA.dhallb b/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..ca67664 --- /dev/null +++ b/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ „õayazax \ No newline at end of file diff --git a/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsB.dhallb b/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..072448d --- /dev/null +++ b/test/normalization/beta/UnionProjectConstructorNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0ƒ ayax \ No newline at end of file diff --git a/test/normalization/beta/UnionSortAlternativesA.dhallb b/test/normalization/beta/UnionSortAlternativesA.dhallb new file mode 100644 index 0000000..520ecf7 --- /dev/null +++ b/test/normalization/beta/UnionSortAlternativesA.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay¢azaAayaB \ No newline at end of file diff --git a/test/normalization/beta/UnionSortAlternativesB.dhallb b/test/normalization/beta/UnionSortAlternativesB.dhallb new file mode 100644 index 0000000..28d3b70 --- /dev/null +++ b/test/normalization/beta/UnionSortAlternativesB.dhallb @@ -0,0 +1 @@ +‚e5.0.0„ axay¢ayaBazaA \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeA.dhallb b/test/normalization/beta/UnionTypeA.dhallb new file mode 100644 index 0000000..be811d4 --- /dev/null +++ b/test/normalization/beta/UnionTypeA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ ¢azaAaxaB \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeB.dhallb b/test/normalization/beta/UnionTypeB.dhallb new file mode 100644 index 0000000..af8284b --- /dev/null +++ b/test/normalization/beta/UnionTypeB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ ¢axaBazaA \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeEmptyA.dhallb b/test/normalization/beta/UnionTypeEmptyA.dhallb new file mode 100644 index 0000000..e135a11 --- /dev/null +++ b/test/normalization/beta/UnionTypeEmptyA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚   \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeEmptyB.dhallb b/test/normalization/beta/UnionTypeEmptyB.dhallb new file mode 100644 index 0000000..e135a11 --- /dev/null +++ b/test/normalization/beta/UnionTypeEmptyB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚   \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeNormalizeArgumentsA.dhallb b/test/normalization/beta/UnionTypeNormalizeArgumentsA.dhallb new file mode 100644 index 0000000..8bd979a --- /dev/null +++ b/test/normalization/beta/UnionTypeNormalizeArgumentsA.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ ¢ax„õaBaZazaA \ No newline at end of file diff --git a/test/normalization/beta/UnionTypeNormalizeArgumentsB.dhallb b/test/normalization/beta/UnionTypeNormalizeArgumentsB.dhallb new file mode 100644 index 0000000..af8284b --- /dev/null +++ b/test/normalization/beta/UnionTypeNormalizeArgumentsB.dhallb @@ -0,0 +1 @@ +‚e5.0.0‚ ¢axaBazaA \ No newline at end of file -- 2.34.5