diff options
Diffstat (limited to 'stdlib/source/library/lux/control/parser/type.lux')
-rw-r--r-- | stdlib/source/library/lux/control/parser/type.lux | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index e6ea2b3dd..029d130fd 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -1,6 +1,4 @@ (.module: - {#.doc (.example "Parsing of Lux types." - "Used mostly for polytypic programming.")} [library [lux (#- function local) [abstract @@ -61,15 +59,12 @@ (text.interposed ""))])) (type: .public Env - {#.doc (example "An environment for type parsing.")} (Dictionary Nat [Type Code])) (type: .public (Parser a) - {#.doc (example "A parser of Lux types.")} (//.Parser [Env (List Type)] a)) (def: .public fresh - {#.doc (example "An empty parsing environment.")} Env (dictionary.empty n.hash)) @@ -88,13 +83,10 @@ (exception.except ..unconsumed_input remaining)))) (def: .public (result poly type) - {#.doc (example "Applies a parser against a type." - "Verifies that the parser fully consumes the type's information.")} (All [a] (-> (Parser a) Type (Try a))) (result' ..fresh poly (list type))) (def: .public env - {#.doc (example "Yields the current parsing environment.")} (Parser Env) (.function (_ [env inputs]) (#try.Success [[env inputs] env]))) @@ -110,7 +102,6 @@ (#try.Success [[env remaining] output])))) (def: .public next - {#.doc (example "Inspect a type in the input stream without consuming it.")} (Parser Type) (.function (_ [env inputs]) (case inputs @@ -121,7 +112,6 @@ (#try.Success [[env inputs] headT])))) (def: .public any - {#.doc (example "Yields a type, without examination.")} (Parser Type) (.function (_ [env inputs]) (case inputs @@ -132,7 +122,6 @@ (#try.Success [[env tail] headT])))) (def: .public (local types poly) - {#.doc (example "Apply a parser to the given inputs.")} (All [a] (-> (List Type) (Parser a) (Parser a))) (.function (_ [env pass_through]) (case (result' env poly types) @@ -222,7 +211,6 @@ (in [funcL all_varsL output]))))) (def: .public (function in_poly out_poly) - {#.doc (example "Parses a function's inputs and output.")} (All [i o] (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any @@ -233,7 +221,6 @@ (//.failure (exception.error ..not_function headT))))) (def: .public (applied poly) - {#.doc (example "Parses a type application.")} (All [a] (-> (Parser a) (Parser a))) (do //.monad [headT any @@ -242,9 +229,8 @@ (//.failure (exception.error ..not_application headT)) (..local (#.Item funcT paramsT) poly)))) -(template [<name> <test> <doc>] +(template [<name> <test>] [(def: .public (<name> expected) - {#.doc (example <doc>)} (-> Type (Parser Any)) (do //.monad [actual any] @@ -252,12 +238,9 @@ (in []) (//.failure (exception.error ..types_do_not_match [expected actual])))))] - [exactly type\= - "Parses a type exactly."] - [sub check.subsumes? - "Parses a sub type."] - [super (function.flipped check.subsumes?) - "Parses a super type."] + [exactly type\=] + [sub check.subsumes?] + [super (function.flipped check.subsumes?)] ) (def: .public (adjusted_idx env idx) @@ -299,7 +282,6 @@ (//.failure (exception.error ..not_parameter headT))))) (def: .public existential - {#.doc (example "Yields an existential type.")} (Parser Nat) (do //.monad [headT any] @@ -311,7 +293,6 @@ (//.failure (exception.error ..not_existential headT))))) (def: .public named - {#.doc (example "Yields a named type.")} (Parser [Name Type]) (do //.monad [inputT any] |