Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #10

Merged
merged 3 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hw-prelude.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ library

exposed-modules: HaskellWorks.Control.Monad
HaskellWorks.Data.String
HaskellWorks.Either
HaskellWorks.Error
HaskellWorks.Error.Types
HaskellWorks.Error.Types.GenericError
Expand Down
10 changes: 10 additions & 0 deletions src/HaskellWorks/Either.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module HaskellWorks.Either
( orElse
) where

import Data.Either
import Data.Function

orElse :: Either e a -> Either e a -> Either e a
orElse a b =
either (const b) Right a
13 changes: 4 additions & 9 deletions src/HaskellWorks/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ module HaskellWorks.Prelude
(&&),
(||),
(.),
(</>),

void,
mapM_,
Expand Down Expand Up @@ -102,6 +101,7 @@ module HaskellWorks.Prelude
(<$!>),

(<$>),
(<&>),

(<**>),
liftA,
Expand All @@ -111,13 +111,6 @@ module HaskellWorks.Prelude

for_,

zip,
zip3,
zipWith,
zipWith3,
unzip,
unzip3,

Read(..),
readEither,

Expand Down Expand Up @@ -148,6 +141,7 @@ module HaskellWorks.Prelude

Monad(..),
MonadFail(..),
MonadIO(..),
MonadPlus(..),
Applicative(..),
Alternative(..),
Expand Down Expand Up @@ -194,6 +188,7 @@ module HaskellWorks.Prelude
import Control.Applicative
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Except
import Data.Bifunctor
import Data.Bool
Expand All @@ -205,6 +200,7 @@ import Data.Either
import Data.Eq
import Data.Foldable
import Data.Function
import Data.Functor
import Data.Functor.Contravariant
import Data.Functor.Contravariant.Divisible
import Data.Functor.Identity
Expand All @@ -229,7 +225,6 @@ import GHC.Real
import GHC.Stack
import HaskellWorks.Error
import Prelude
import System.FilePath
import System.IO (Handle)
import Text.Read

Expand Down
Loading