Unverified Commit 24eac4c1 authored by Camil Staps's avatar Camil Staps Committed by GitHub
Browse files

Merge pull request #184 from clean-cloogle/extend_unique

Extend uniqueness syntax construct
parents 270c5135 3c9edac1
......@@ -515,13 +515,26 @@ bs_synonym_abstract =
bs_unique =
{ syntax_title = "uniqueness annotation"
, syntax_patterns = ["\\*"]
, syntax_code = ["*..."]
, syntax_description = "Annotates a type to be unique."
, syntax_patterns = ["\\*", ".", "%:", "[*<=*]", ","]
, syntax_code =
[ "*..."
, ". ..."
, "...:... | [...<=...], [...<=...], ..."
]
, syntax_description = join " "
[ "Annotates a type with its uniqueness."
, "A type can either be unique (`*`), not unique (not annotated), possibly unique (`.`) or relatively unique (identifier and `| [...<=...]`)."
, "\n\nNote that when using unique types in a function or an ADT the container must also be unique."
, "For instance, `T = T (Int, *File)` has to be `T = T *(Int, *File)`."
, "\n\nFunctions have to be split up into arity 1 and the sub functions need to be annotated as well."
, "For instance, `T = T (Int *Int -> *Int)` has to be `T = T (Int -> *(*Int -> *Int))`."
]
, syntax_doc_locations = [CLR 11 "9.1" "_Toc311798093"]
, syntax_examples = map EX
[ "Start :: *World -> *World"
, "copyArray :: *(a e) -> *(*a e, *a e) | Array a e"
[ "Start :: *World -> *World // World is unique"
, "copyArray :: *(a e) -> *(*a e, *a e) | Array a e // Add parenthesis when needed"
, "f :: .a -> .a // f works on unique and non-unique values"
, "f :: v:a u:b -> u:b | [v<=u] // f works when a is less unique than b"
]
}
......
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