aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/lux/abstract/mix.lux
blob: aecd00cbbf073ffef4e8ee66afe564e393f4fca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(.module:
  [library
   [lux "*"
    ["_" test {"+" [Test]}]
    [abstract
     [monad {"+" [do]}]]
    [math
     ["[0]" random]
     [number
      ["n" nat]]]]]
  [//
   [functor {"+" [Injection Comparison]}]]
  [\\library
   ["[0]" /]])

(def: .public (spec injection comparison (^open "@//[0]"))
  (All (_ f) (-> (Injection f) (Comparison f) (/.Mix f) Test))
  (do random.monad
    [subject random.nat
     parameter random.nat]
    (_.cover [/.Mix]
             (n.= (@//mix n.+ parameter (injection subject))
                  (n.+ parameter subject)))))