Skip to content

Commit 3607e71

Browse files
committed
New orElse function
1 parent 984ba19 commit 3607e71

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

hw-prelude.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ library
9292

9393
exposed-modules: HaskellWorks.Control.Monad
9494
HaskellWorks.Data.String
95+
HaskellWorks.Either
9596
HaskellWorks.Error
9697
HaskellWorks.Error.Types
9798
HaskellWorks.Error.Types.GenericError

src/HaskellWorks/Either.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
module HaskellWorks.Data.Either
2-
( eitherToMaybe
3-
, maybeToEither
1+
module HaskellWorks.Either
2+
( orElse
43
) where
4+
5+
import Data.Either
6+
import Data.Function
7+
8+
orElse :: Either e a -> Either e a -> Either e a
9+
orElse a b =
10+
either (const b) Right a

0 commit comments

Comments
 (0)