aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/meta/type/refinement.lux
blob: 304b4b2665ea70feaee7d3c94b97b6b022df0507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(.def .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [($.default /.value)
             ($.default /.predicate)

             ($.documentation (/.Refined it)
               "A refined version of another type, using a predicate to select valid instances.")

             ($.documentation (/.Refiner it)
               "A selection mechanism for refined instances of a type.")

             ($.documentation /.refiner
               ""
               [(refiner predicate)])

             ($.documentation /.lifted
               (format "Yields a function that can work on refined values."
                       \n "Respects the constraints of the refinement.")
               [(lifted transform)])

             ($.documentation /.only
               ""
               [(only refiner values)])

             ($.documentation /.partition
               "Separates refined values from the un-refined ones."
               [(partition refiner values)])

             ($.documentation /.type
               "The Refined type associated with a Refiner type."
               [(def even
                  (refiner even?))

                (def Even
                  Type
                  (type even))

                (is (Maybe Even)
                    (even 123))])]
            []))