|
definition: |
readParen :: Bool -> ReadS a -> ReadS a
readParen b g = if b then mandatory else optional
where optional r = g r ++ mandatory r
mandatory r =
[(x, u) | ("(", s) <- lex r, (x, t) <- optional s, (")", u) <- lex t]
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
| `readParen True p` parses what `p` parses, but surrounded with parentheses. `readParen False p` parses what `p` parses, but the string to be parsed can be optionally with parentheses. |
|
failfree: |
(_, _) |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({True},_) |-> {readParen.mandatory.75} || ({False},_) |-> {readParen.optional.75}}
|
|
name: |
readParen |
|
precedence: |
no precedence defined |
|
result-values: |
{readParen.mandatory.75,readParen.optional.75}
|
|
signature: |
Bool -> ([Char] -> [(a, [Char])]) -> [Char] -> [(a, [Char])] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |