serokell / universum

:milky_way: Prelude written in @Serokell
MIT License
176 stars 26 forks source link

[#230] Add `hoistMaybe` and `hoistEither` functions #231

Closed gpevnev closed 4 years ago

gpevnev commented 4 years ago

Description

Problem: Currently to lift a value ma :: Maybe a into MaybeT m a you need to write MaybeT (pure ma), which is bloating code with unnecessary boilerplate. Same idea applies for Either e a and ExceptT e m a. `

Proposed solution: Add functions hoistMaybe :: Applicative m => Maybe a -> MaybeT m a and hoistEither :: Applicative m => Either e a -> ExceptT e m a

Related issues

✓ Checklist for your Pull Request

Ideally a PR has all of the checkmarks set.

If something in this list is irrelevant to your PR, you should still set this checkmark indicating that you are sure it is dealt with (be that by irrelevance).

Related changes (conditional)

Stylistic guide (mandatory)

gpevnev commented 4 years ago

@gromakovsky should I add it as a new minor version (1.7.1 for example)

gromakovsky commented 4 years ago

If I understand PVP correctly, yes. Typically we write Unreleased in the changelog and replace it with the actual version when a new release is ready to be made, but in this case I suppose we can release 1.7.1 right after merging this PR.