aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/meta/type
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation/lux/meta/type')
-rw-r--r--stdlib/source/documentation/lux/meta/type/check.lux16
-rw-r--r--stdlib/source/documentation/lux/meta/type/dynamic.lux8
-rw-r--r--stdlib/source/documentation/lux/meta/type/implicit.lux38
-rw-r--r--stdlib/source/documentation/lux/meta/type/poly.lux2
-rw-r--r--stdlib/source/documentation/lux/meta/type/primitive.lux157
-rw-r--r--stdlib/source/documentation/lux/meta/type/quotient.lux17
-rw-r--r--stdlib/source/documentation/lux/meta/type/refinement.lux25
-rw-r--r--stdlib/source/documentation/lux/meta/type/resource.lux36
-rw-r--r--stdlib/source/documentation/lux/meta/type/unit.lux6
9 files changed, 154 insertions, 151 deletions
diff --git a/stdlib/source/documentation/lux/meta/type/check.lux b/stdlib/source/documentation/lux/meta/type/check.lux
index 55cbfd5b1..82fd02c56 100644
--- a/stdlib/source/documentation/lux/meta/type/check.lux
+++ b/stdlib/source/documentation/lux/meta/type/check.lux
@@ -33,19 +33,19 @@
($.definition /.result
""
- [(result context proc)])
+ ($.example (result context proc)))
($.definition /.failure
""
- [(failure message)])
+ ($.example (failure message)))
($.definition /.assertion
""
- [(assertion message test)])
+ ($.example (assertion message test)))
($.definition /.except
""
- [(except exception message)])
+ ($.example (except exception message)))
($.definition /.existential
"A brand-new existential type.")
@@ -53,7 +53,7 @@
($.definition /.bind
(format "Attemmpts to buy a type-variable."
\n "Fails if the variable has been bound already.")
- [(bind type id)])
+ ($.example (bind type id)))
($.definition /.var
"A brand-new (unbound) type-variable.")
@@ -63,16 +63,16 @@
($.definition /.check
"Type-check to ensure that the 'expected' type subsumes the 'actual' type."
- [(check expected actual)])
+ ($.example (check expected actual)))
($.definition /.subsumes?
"A simple type-checking function that just returns a yes/no answer."
- [(subsumes? expected actual)])
+ ($.example (subsumes? expected actual)))
($.definition /.context
"The current state of the type-checking context.")
($.definition /.clean
"Resolves every bound type-variable to yield a new type that is as resolved as possible."
- [(clean inputT)])
+ ($.example (clean inputT)))
))
diff --git a/stdlib/source/documentation/lux/meta/type/dynamic.lux b/stdlib/source/documentation/lux/meta/type/dynamic.lux
index af54272d6..18db9468f 100644
--- a/stdlib/source/documentation/lux/meta/type/dynamic.lux
+++ b/stdlib/source/documentation/lux/meta/type/dynamic.lux
@@ -21,11 +21,11 @@
($.definition /.dynamic
""
- [(is Dynamic
- (dynamic 123))])
+ ($.example (is Dynamic
+ (dynamic 123))))
($.definition /.static
""
- [(is (try.Try Nat)
- (static Nat (dynamic 123)))])
+ ($.example (is (try.Try Nat)
+ (static Nat (dynamic 123)))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/implicit.lux b/stdlib/source/documentation/lux/meta/type/implicit.lux
index 54ded8081..4803008c0 100644
--- a/stdlib/source/documentation/lux/meta/type/implicit.lux
+++ b/stdlib/source/documentation/lux/meta/type/implicit.lux
@@ -25,28 +25,30 @@
\n "a compile-time error will be raised, to alert the user."
\n \n "Caveat emptor: You need to make sure to import the module of any implementation you want to use."
\n "Otherwise, this macro will not find it.")
- ["Nat equivalence"
- (at number.equivalence = x y)
- (a/an = x y)]
- ["Can optionally add the prefix of the module where the signature was defined."
- (a/an equivalence.= x y)]
- ["(List Nat) equivalence"
- (a/an =
- (list.indices 10)
- (list.indices 10))]
- ["(Functor List) each"
- (a/an each ++ (list.indices 10))])
+ ($.example ($.comment "Nat equivalence"))
+ ($.example (at number.equivalence = x y))
+ ($.example (a/an = x y))
+
+ ($.comment "Can optionally add the prefix of the module where the signature was defined.")
+ ($.example (a/an equivalence.= x y))
+
+ ($.comment "(List Nat) equivalence")
+ ($.example (a/an =
+ (list.indices 10)
+ (list.indices 10)))
+
+ ($.comment "(Functor List) each")
+ ($.example (a/an each ++ (list.indices 10))))
($.definition /.with
"Establish lexical bindings for implementations that will be prioritized over non-lexically-bound implementations."
- [(with [n.addition]
- (n.= (at n.addition composite left right)
- (a/an composite left right)))])
+ ($.example (with [n.addition]
+ (n.= (at n.addition composite left right)
+ (a/an composite left right)))))
($.definition /.implicitly
"Establish local definitions for implementations that will be prioritized over foreign definitions."
- [(implicitly n.multiplication)
-
- (n.= (at n.multiplication composite left right)
- (a/an composite left right))])
+ ($.example (implicitly n.multiplication))
+ ($.example (n.= (at n.multiplication composite left right)
+ (a/an composite left right))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/poly.lux b/stdlib/source/documentation/lux/meta/type/poly.lux
index fb33e6236..b781bb5c8 100644
--- a/stdlib/source/documentation/lux/meta/type/poly.lux
+++ b/stdlib/source/documentation/lux/meta/type/poly.lux
@@ -21,5 +21,5 @@
($.definition /.code
""
- [(code env type)])
+ ($.example (code env type)))
))
diff --git a/stdlib/source/documentation/lux/meta/type/primitive.lux b/stdlib/source/documentation/lux/meta/type/primitive.lux
index 04a751666..036489d22 100644
--- a/stdlib/source/documentation/lux/meta/type/primitive.lux
+++ b/stdlib/source/documentation/lux/meta/type/primitive.lux
@@ -21,15 +21,15 @@
($.definition /.specific
"A specific abstract/nominal type still being defined somewhere in the scope."
- [(specific name)])
+ ($.example (specific name)))
(,, (with_template [<name> <from> <$> <to>]
[($.definition <name>
"Type-casting macro for abstract/nominal types."
- [(|> value
- (is <from>)
- <$>
- (is <to>))])]
+ ($.example (|> value
+ (is <from>)
+ <$>
+ (is <to>))))]
[/.abstraction Representation abstraction Abstraction]
[/.representation Abstraction representation Representation]
@@ -38,82 +38,85 @@
($.definition /.def
(format "Define abstract/nominal types which hide their representation details."
\n "You can convert between the abstraction and its representation selectively to access the value, while hiding it from others.")
- [(/.def String
- Text
-
- (.def (string value)
- (-> Text String)
- (abstraction value))
-
- (.def (text value)
- (-> String Text)
- (representation value)))]
- ["Type-parameters are optional."
- (/.def (Duplicate a)
- [a a]
-
- (.def (duplicate value)
- (All (_ a) (-> a (Duplicate a)))
- (abstraction [value value])))]
- ["Definitions can be nested."
- (/.def (Single a)
- a
-
- (.def (single value)
- (All (_ a) (-> a (Single a)))
- (abstraction value))
-
- (/.def (Double a)
- [a a]
-
- (.def (double value)
- (All (_ a) (-> a (Double a)))
- (abstraction [value value]))
-
- (.def (single' value)
- (All (_ a) (-> a (Single a)))
- (abstraction Single [value value]))
-
- (let [value 0123]
- (same? value
- (|> value
- single'
- (representation Single)
- double
- representation)))))]
- ["Type-parameters do not necessarily have to be used in the representation type."
- "If they are not used, they become phantom types and can be used to customize types without changing the representation."
- (/.def (JavaScript a)
- Text
-
- (/.def Expression Any)
- (/.def Statement Any)
-
- (.def (+ x y)
- (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression))
- (abstraction
- (format "(" (representation x) "+" (representation y) ")")))
-
- (.def (while test body)
- (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement))
- (abstraction
- (format "while(" (representation test) ") {"
- (representation body)
- "}"))))])
+ ($.example (/.def String
+ Text
+
+ (.def (string value)
+ (-> Text String)
+ (abstraction value))
+
+ (.def (text value)
+ (-> String Text)
+ (representation value))))
+
+ ($.comment "Type-parameters are optional.")
+ ($.example (/.def (Duplicate a)
+ [a a]
+
+ (.def (duplicate value)
+ (All (_ a) (-> a (Duplicate a)))
+ (abstraction [value value]))))
+
+ ($.comment "Definitions can be nested.")
+ ($.example (/.def (Single a)
+ a
+
+ (.def (single value)
+ (All (_ a) (-> a (Single a)))
+ (abstraction value))
+
+ (/.def (Double a)
+ [a a]
+
+ (.def (double value)
+ (All (_ a) (-> a (Double a)))
+ (abstraction [value value]))
+
+ (.def (single' value)
+ (All (_ a) (-> a (Single a)))
+ (abstraction Single [value value]))
+
+ (let [value 0123]
+ (same? value
+ (|> value
+ single'
+ (representation Single)
+ double
+ representation))))))
+
+ ($.comment "Type-parameters do not necessarily have to be used in the representation type.")
+ ($.comment "If they are not used, they become phantom types and can be used to customize types without changing the representation.")
+ ($.example (/.def (JavaScript a)
+ Text
+
+ (/.def Expression Any)
+ (/.def Statement Any)
+
+ (.def (+ x y)
+ (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression))
+ (abstraction
+ (format "(" (representation x) "+" (representation y) ")")))
+
+ (.def (while test body)
+ (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement))
+ (abstraction
+ (format "while(" (representation test) ") {"
+ (representation body)
+ "}"))))))
($.definition /.transmutation
"Transmutes an abstract/nominal type's phantom types."
- [(/.def (JavaScript a)
- Text
+ ($.example (/.def (JavaScript a)
+ Text
- (/.def Expression Any)
- (/.def Statement Any)
+ (/.def Expression Any)
+ (/.def Statement Any)
- (.def (statement expression)
- (-> (JavaScript Expression) (JavaScript Statement))
- (transmutation expression))
+ (.def (statement expression)
+ (-> (JavaScript Expression) (JavaScript Statement))
+ (transmutation expression))
- (.def (statement' expression)
- (-> (JavaScript Expression) (JavaScript Statement))
- (transmutation JavaScript expression)))])
+ (.def (statement' expression)
+ (-> (JavaScript Expression) (JavaScript Statement))
+ (transmutation JavaScript expression)))))
)))
diff --git a/stdlib/source/documentation/lux/meta/type/quotient.lux b/stdlib/source/documentation/lux/meta/type/quotient.lux
index e374a11c5..07d3c0751 100644
--- a/stdlib/source/documentation/lux/meta/type/quotient.lux
+++ b/stdlib/source/documentation/lux/meta/type/quotient.lux
@@ -28,17 +28,16 @@
($.definition /.quotient
""
- [(quotient class value)])
+ ($.example (quotient class value)))
($.definition /.type
"The Quotient type associated with a Class type."
- [(def even
- (class even?))
- (def Even
- Type
- (type even))
-
- (is Even
- (quotient even 123))])
+ ($.example (def even
+ (class even?)))
+ ($.example (def Even
+ Type
+ (type even)))
+ ($.example (is Even
+ (quotient even 123))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/refinement.lux b/stdlib/source/documentation/lux/meta/type/refinement.lux
index 0b9601f1e..104a57b3e 100644
--- a/stdlib/source/documentation/lux/meta/type/refinement.lux
+++ b/stdlib/source/documentation/lux/meta/type/refinement.lux
@@ -24,30 +24,29 @@
($.definition /.refiner
""
- [(refiner predicate)])
+ ($.example (refiner predicate)))
($.definition /.lifted
(format "Yields a function that can work on refined values."
\n "Respects the constraints of the refinement.")
- [(lifted transform)])
+ ($.example (lifted transform)))
($.definition /.only
""
- [(only refiner values)])
+ ($.example (only refiner values)))
($.definition /.partition
"Separates refined values from the un-refined ones."
- [(partition refiner values)])
+ ($.example (partition refiner values)))
($.definition /.type
"The Refined type associated with a Refiner type."
- [(def even
- (refiner even?))
-
- (def Even
- Type
- (type even))
-
- (is (Maybe Even)
- (even 123))])
+
+ ($.example (def even
+ (refiner even?)))
+ ($.example (def Even
+ Type
+ (type even)))
+ ($.example (is (Maybe Even)
+ (even 123))))
))
diff --git a/stdlib/source/documentation/lux/meta/type/resource.lux b/stdlib/source/documentation/lux/meta/type/resource.lux
index ed1f271f3..c8e34ab6e 100644
--- a/stdlib/source/documentation/lux/meta/type/resource.lux
+++ b/stdlib/source/documentation/lux/meta/type/resource.lux
@@ -35,11 +35,11 @@
($.definition /.run!
""
- [(run! monad procedure)])
+ ($.example (run! monad procedure)))
($.definition /.lifted
""
- [(lifted monad procedure)])
+ ($.example (lifted monad procedure)))
($.definition /.Ordered
"The mode of keys which CANNOT be swapped, and for whom order of release/consumption matters.")
@@ -65,31 +65,31 @@
($.definition /.read
"Access the value of a resource, so long as its key is available."
- [(read monad resource)])
+ ($.example (read monad resource)))
($.definition /.exchange
(format "A function that can exchange the keys for resource, so long as they are commutative."
\n "This keys will be placed at the front of the keyring in the order they are specified."
\n "The specific keys must be specified based of their index into the current keyring.")
- [(do (monad !)
- [res|left (commutative ! pre)
- res|right (commutative ! post)
- _ ((exchange [1 0]) !)
- left (read ! res|left)
- right (read ! res|right)]
- (in (format left right)))])
+ ($.example (do (monad !)
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((exchange [1 0]) !)
+ left (read ! res|left)
+ right (read ! res|right)]
+ (in (format left right)))))
(,, (with_template [<name>]
[($.definition <name>
"Group/un-group keys in the keyring into/out-of tuples."
- [(do (monad !)
- [res|left (commutative ! pre)
- res|right (commutative ! post)
- _ ((group 2) !)
- _ ((un_group 2) !)
- right (read ! res|right)
- left (read ! res|left)]
- (in (format left right)))])]
+ ($.example (do (monad !)
+ [res|left (commutative ! pre)
+ res|right (commutative ! post)
+ _ ((group 2) !)
+ _ ((un_group 2) !)
+ right (read ! res|right)
+ left (read ! res|left)]
+ (in (format left right)))))]
[/.group]
[/.un_group]
diff --git a/stdlib/source/documentation/lux/meta/type/unit.lux b/stdlib/source/documentation/lux/meta/type/unit.lux
index 606184c7a..67157d892 100644
--- a/stdlib/source/documentation/lux/meta/type/unit.lux
+++ b/stdlib/source/documentation/lux/meta/type/unit.lux
@@ -54,15 +54,15 @@
($.definition /.unit
(format "Define a unit of measurement."
\n "Both the name of the type, and the name of the Unit implementation must be specified.")
- [(def feet (unit []))])
+ ($.example (def feet (unit []))))
... ($.definition /.scale
... "Define a scale of magnitude."
- ... [(def bajillion (scale [1 1,234,567,890]))])
+ ... ($.example (def bajillion (scale [1 1,234,567,890]))))
... ($.definition /.re_scaled
... ""
- ... [(re_scaled from to measure)])
+ ... ($.example (re_scaled from to measure)))
... (,, (with_template [<type> <scale>]
... [(`` ($.definition <scale>