File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -865,6 +865,32 @@ The `cata` method takes two arguments:
865
865
1 . If `f` is not a function, the behaviour of `cata` is unspecified.
866
866
2 . No parts of `f` 's return value should be checked.
867
867
868
+ ### Either
869
+
870
+ The `Either ` type encodes the concept of binary possibility (Left a and Right b).
871
+
872
+ ```hs
873
+ Either a b = { cata :: ((a -> c ), (b -> c )) -> c }
874
+ left :: a -> Either a b
875
+ right :: b -> Either a b
876
+ ```
877
+
878
+ A value which conforms to the Either specification must provide an `cata` method.
879
+
880
+ The `cata` method takes two arguments:
881
+
882
+ e. cata(f, g)
883
+
884
+ 1 . `f` must be a function which returns a value
885
+
886
+ 1 . If `f` is not a function, the behaviour of `cata` is unspecified.
887
+ 2 . No parts of `f` 's return value should be checked.
888
+
889
+ 2 . `g` must be a function which returns a value
890
+
891
+ 1 . If `g` is not a function, the behaviour of `cata` is unspecified.
892
+ 2 . No parts of `g` 's return value should be checked.
893
+
868
894
## Derivations
869
895
870
896
When creating data types which satisfy multiple algebras, authors may choose
You can’t perform that action at this time.
0 commit comments