definition: |
wEither :: (Eq a, Eq b) => WuiSpec a -> WuiSpec b -> WuiSpec (Either a b) wEither (WuiSpec rendera showa cora reada) (WuiSpec renderb showb corb readb) = WuiSpec (head, "?", const True) showEither corEither readEither where showEither (render,errmsg,legal) nocheck (Left va) = let (hea,rta) = showa rendera nocheck va in ((if nocheck || legal (Left va) then render else renderError render errmsg) [hea], altstate2state (1,rta)) showEither (render,errmsg,legal) nocheck (Right vb) = let (heb,rtb) = showb renderb nocheck vb in ((if nocheck || legal (Right vb) then render else renderError render errmsg) [heb], altstate2state (2,rtb)) corEither wparam vab = conditionOf wparam vab && either (cora rendera) (corb renderb) vab readEither env s = let (altindex,rab) = state2altstate s in case altindex of 1 -> Left (reada env rab) 2 -> Right (readb env rab) |
demand: |
arguments 3 4 |
deterministic: |
deterministic operation |
documentation: |
--- WUI for union types. --- Here we provide only the implementation for Either types --- since other types with more alternatives can be easily reduced to this case. |
failfree: |
<FAILING> |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_,{WuiSpec},{WuiSpec}) |-> {WuiSpec}} |
name: |
wEither |
precedence: |
no precedence defined |
result-values: |
{WuiSpec} |
signature: |
(Prelude.Eq a, Prelude.Eq b) => WuiSpec a -> WuiSpec b -> WuiSpec (Prelude.Either a b) |
solution-complete: |
operation might suspend on free variables |
terminating: |
yes |
totally-defined: |
possibly non-reducible on same data term |