From bd5272c116c34883bc0e6722a973067700f6dc06 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 6 Aug 2017 14:29:17 -0400 Subject: - Added poly/eq support for time types and unit types. --- stdlib/source/lux/macro/poly/eq.lux | 83 ++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 34 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/macro/poly/eq.lux b/stdlib/source/lux/macro/poly/eq.lux index 20bda8be7..3b00591a8 100644 --- a/stdlib/source/lux/macro/poly/eq.lux +++ b/stdlib/source/lux/macro/poly/eq.lux @@ -17,40 +17,52 @@ [product] [bool] [maybe]) + (time ["du" duration] + ["da" date] + ["i" instant]) [macro #+ Monad with-gensyms] (macro [code] [syntax #+ syntax: Syntax] (syntax [common]) [poly #+ poly:]) [type] + (type [unit]) )) ## [Derivers] (poly: #export Eq (with-expansions - [ (do-template [ ] + [ (do-template [ ] [(do @ - [[primT _] (p;seq poly;peek )] - (wrap (` (: (~ (@Eq primT)) + [_ ] + (wrap (` (: (~ (@Eq inputT)) ))))] - [Unit poly;unit (function [(~' test) (~' input)] true)] - [Bool poly;bool bool;Eq] - [Nat poly;nat number;Eq] - [Int poly;int number;Eq] - [Deg poly;deg number;Eq] - [Real poly;real number;Eq] - [Text poly;text text;Eq]) + [poly;unit (function [(~' test) (~' input)] true)] + [poly;bool bool;Eq] + [poly;nat number;Eq] + [poly;int number;Eq] + [poly;deg number;Eq] + [poly;real number;Eq] + [poly;text text;Eq]) +