File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
7
7
Breaking changes:
8
8
9
9
New features:
10
+ - Add ` blush ` which is a left-biased ` hush ` , thus turns ` Right ` s into ` Nothing ` s but ` Left ` s into ` Just ` s (#69 ).
10
11
11
12
Bugfixes:
12
13
@@ -148,6 +149,3 @@ Add `Alt` instance
148
149
149
150
150
151
## [ v0.1.0] ( https://github.com/purescript/purescript-either/releases/tag/v0.1.0 ) - 2014-04-21
151
-
152
-
153
-
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ note a = maybe (Left a) Right
273
273
note' :: forall a b . (Unit -> a ) -> Maybe b -> Either a b
274
274
note' f = maybe' (Left <<< f) Right
275
275
276
- -- | Turns an `Either` into a `Maybe`, by throwing eventual `Left` values away and converting
276
+ -- | Turns an `Either` into a `Maybe`, by throwing potential `Left` values away and converting
277
277
-- | them into `Nothing`. `Right` values get turned into `Just`s.
278
278
-- |
279
279
-- | ```purescript
@@ -282,3 +282,13 @@ note' f = maybe' (Left <<< f) Right
282
282
-- | ```
283
283
hush :: forall a b . Either a b -> Maybe b
284
284
hush = either (const Nothing ) Just
285
+
286
+ -- | Turns an `Either` into a `Maybe`, by throwing potential `Right` values away and converting
287
+ -- | them into `Nothing`. `Left` values get turned into `Just`s.
288
+ -- |
289
+ -- | ```purescript
290
+ -- | blush (Left "ParseError") = Just "Parse Error"
291
+ -- | blush (Right 42) = Nothing
292
+ -- | ```
293
+ blush :: forall a b . Either a b -> Maybe a
294
+ blush = either Just (const Nothing )
You can’t perform that action at this time.
0 commit comments