File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,20 @@ import Data.Void (Void, absurd)
29
29
30
30
infixr 6 type Either as \/
31
31
32
- -- | Allows to match nested eithers . For example:
32
+ -- | The `\/` operator alias for the `either` function allows easy matching on nested Eithers . For example, consider the function
33
33
-- |
34
34
-- | ```purescript
35
35
-- | f :: (Int \/ String \/ Boolean) -> String
36
- -- | f = show \/ identity \/ if _ then "yes" else "no"
36
+ -- | f (Left x) = show x
37
+ -- | f (Right (Left y)) = y
38
+ -- | f (Right (Right z)) = if z then "Yes" else "No"
39
+ -- | ```
40
+ -- |
41
+ -- | The `\/` operator alias allows us to rewrite this function as
42
+ -- |
43
+ -- | ```purescript
44
+ -- | f :: (Int \/ String \/ Boolean) -> String
45
+ -- | f = show \/ identity \/ if _ then "Yes" else "No"
37
46
-- | ```
38
47
infixr 6 either as \/
39
48
You can’t perform that action at this time.
0 commit comments