aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification
diff options
context:
space:
mode:
authorEduardo Julian2022-12-22 15:51:13 -0400
committerEduardo Julian2022-12-22 15:51:13 -0400
commit4f4a96635abb04239102e4b72dc2a9c6f678dcd2 (patch)
tree0c42c6c802b6f8f6742b61c4bced1906edfeea81 /stdlib/source/specification
parent240a4465157bb903dd2a3ee4cdc28aadf09f8dcb (diff)
Now showing stack-traces for runtime exceptions in Ruby.
Diffstat (limited to 'stdlib/source/specification')
-rw-r--r--stdlib/source/specification/lux/abstract/comonad.lux53
-rw-r--r--stdlib/source/specification/lux/abstract/monad.lux59
2 files changed, 0 insertions, 112 deletions
diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux
deleted file mode 100644
index 2b89691ec..000000000
--- a/stdlib/source/specification/lux/abstract/comonad.lux
+++ /dev/null
@@ -1,53 +0,0 @@
-(.require
- [library
- [lux (.except)
- [abstract
- [monad (.only do)]
- ["[0]" functor
- ["[1]T" \\test (.only Injection Comparison)]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]]]
- [test
- ["_" property (.only Test)]]]]
- [\\library
- ["[0]" / (.only CoMonad)]])
-
-(def .public (spec injection comparison it)
- (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test))
- (<| (_.for [/.CoMonad])
- (do [! random.monad]
- [.let [(open "/#[0]") it]
- sample random.nat
- increase (of ! each (function (_ diff)
- (|>> /#out (n.+ diff)))
- random.nat)
- decrease (of ! each (function (_ diff)
- (|>> /#out (n.- diff)))
- random.nat)
- morphism (of ! each (function (_ diff)
- (|>> /#out (n.+ diff)))
- random.nat)
- .let [start (injection sample)
- == (comparison n.=)]])
- (all _.and
- (_.for [/.functor]
- (functorT.spec injection comparison (the /.functor it)))
-
- (_.coverage [/.disjoint /.out]
- (let [left_identity!
- (n.= (morphism start)
- (|> start /#disjoint (/#each morphism) /#out))
-
- right_identity!
- (== start
- (|> start /#disjoint (/#each /#out)))
-
- associativity!
- (== (|> start /#disjoint (/#each (|>> /#disjoint (/#each increase) decrease)))
- (|> start /#disjoint (/#each increase) /#disjoint (/#each decrease)))]
- (and left_identity!
- right_identity!
- associativity!)))
- )))
diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux
deleted file mode 100644
index 48db743b8..000000000
--- a/stdlib/source/specification/lux/abstract/monad.lux
+++ /dev/null
@@ -1,59 +0,0 @@
-(.require
- [library
- [lux (.except)
- [abstract
- [functor
- [\\test (.only Injection Comparison)]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]]]
- [test
- ["_" property (.only Test)]]]]
- [\\library
- ["[0]" / (.only do)]])
-
-(def (left_identity injection comparison (open "_//[0]"))
- (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test))
- (do [! random.monad]
- [sample random.nat
- morphism (of ! each (function (_ diff)
- (|>> (n.+ diff) _//in))
- random.nat)]
- (_.test "Left identity."
- ((comparison n.=)
- (|> (injection sample) (_//each morphism) _//conjoint)
- (morphism sample)))))
-
-(def (right_identity injection comparison (open "_//[0]"))
- (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test))
- (do random.monad
- [sample random.nat]
- (_.test "Right identity."
- ((comparison n.=)
- (|> (injection sample) (_//each _//in) _//conjoint)
- (injection sample)))))
-
-(def (associativity injection comparison (open "_//[0]"))
- (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test))
- (do [! random.monad]
- [sample random.nat
- increase (of ! each (function (_ diff)
- (|>> (n.+ diff) _//in))
- random.nat)
- decrease (of ! each (function (_ diff)
- (|>> (n.- diff) _//in))
- random.nat)]
- (_.test "Associativity."
- ((comparison n.=)
- (|> (injection sample) (_//each increase) _//conjoint (_//each decrease) _//conjoint)
- (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint)))))
-
-(def .public (spec injection comparison monad)
- (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test))
- (<| (_.for [/.Monad])
- (all _.and
- (..left_identity injection comparison monad)
- (..right_identity injection comparison monad)
- (..associativity injection comparison monad)
- )))