Commit 5e10123c authored by Mart Lubbers's avatar Mart Lubbers

Add documentation for =: as an inline pattern match

parent 0d7d7ce8
......@@ -38,7 +38,7 @@ builtin_syntax =
, bs_newtype
, bs_overloaded_type_variable
, bs_otherwise
, bs_pattern_named
, bs_pattern
, bs_selection_array
, bs_selection_array_unique
, bs_selection_record
......@@ -427,15 +427,16 @@ bs_otherwise =
]
}
bs_pattern_named =
{ syntax_title = "named pattern match"
bs_pattern =
{ syntax_title = "pattern match"
, syntax_patterns = ["=:"]
, syntax_code = ["...=:(...)"]
, syntax_description = "Give a name to the expression of a pattern to be able to use the whole expression without creating new graphs."
, syntax_description = "Give a name to the expression of a pattern to be able to use the whole expression without creating new graphs. This can also be used to check if a value (not a function argument) matches a pattern (undocumented and you can not use identifiers). `=:` can not be used in prefix form because it is not an actual operator but a builtin."
, syntax_doc_locations = [CLR 5 "3.2" "_Toc311797997"]
, syntax_examples =
[ EXs "macro" "isJustU e=:(Just _) = (True, e) // On an ADT"
, EX ":: Position = {px :: Int, py :: Int}\ngetx p=:{px} = (px, p) // On a record; this has type :: Position -> (Int, Position)"
, EX "isSingleton l = l =: [_] //Match a value with a pattern"
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment