diff options
author | Eduardo Julian | 2020-05-28 02:18:02 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-05-28 02:18:02 -0400 |
commit | 2139e72d8e7c58cb355799d4a8412a0c38fb481c (patch) | |
tree | abc4dd07dc9ab0342e3cb379b40fa2c4a337e552 /stdlib/source/spec | |
parent | 853642c340730b3bb23c1ac87660c5c7ecbffa93 (diff) |
Can now parse TAR files.
Diffstat (limited to 'stdlib/source/spec')
-rw-r--r-- | stdlib/source/spec/lux/abstract/functor/contravariant.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/stdlib/source/spec/lux/abstract/functor/contravariant.lux b/stdlib/source/spec/lux/abstract/functor/contravariant.lux new file mode 100644 index 000000000..b21e28e68 --- /dev/null +++ b/stdlib/source/spec/lux/abstract/functor/contravariant.lux @@ -0,0 +1,31 @@ +(.module: + [lux #* + [abstract + [equivalence (#+ Equivalence)] + [monad (#+ do)]] + [data + [number + ["n" nat]]] + [control + ["." function]] + [math + ["." random]] + ["_" test (#+ Test)]] + {1 + ["." / (#+ Functor)]}) + +(def: (identity equivalence value (^open "/@.")) + (All [f a] (-> (Equivalence (f a)) (f a) (Functor f) Test)) + (_.test "Law of identity." + (equivalence + (/@map function.identity value) + value))) + +(def: #export (spec equivalence value functor) + (All [f a] (-> (Equivalence (f a)) (f a) (Functor f) Test)) + (do random.monad + [sample random.nat] + (<| (_.with-cover [/.Functor]) + ($_ _.and + (..identity equivalence value functor) + )))) |