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)
2929
3030infixr 6 type Either as \/
3131
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
3333-- |
3434-- | ```purescript
3535-- | 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"
3746-- | ```
3847infixr 6 either as \/
3948
You can’t perform that action at this time.
0 commit comments