5 | import Data.List.Elem
6 | import Data.List.Quantifiers
10 | {schema: Type -> Type} ->
17 | transformNamed name aToB bToA =
18 | validateNamed name aToB (Right . bToA)
22 | {schema: Type -> Type} -> {a: Type} -> {b: Type} ->
28 | eitherOfNamed name leftSchema rightSchema =
30 | toUnion : Either a b -> Union [a, b]
31 | toUnion eitherAOrB =
34 | Right b => There $
Here b
36 | fromUnion : Union [a, b] -> Either a b
40 | There (Here bb) => Right bb
42 | unionSchema : schema (Union [a, b])
45 | unionMemberWithIndex Here leftSchema
46 | #| unionMemberWithIndex (There Here) rightSchema