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

Add a maybe function for MaybeT like the except for ExceptT #123

Open
garyb opened this issue May 7, 2020 · 4 comments
Open

Add a maybe function for MaybeT like the except for ExceptT #123

garyb opened this issue May 7, 2020 · 4 comments
Labels
type: enhancement A new feature or addition.

Comments

@garyb
Copy link
Member

garyb commented May 7, 2020

No description provided.

@ursi
Copy link
Contributor

ursi commented Jan 26, 2021

I definitely support this, however, should it be named maybe? as it would clash with maybe.

@JordanMartinez JordanMartinez added the type: enhancement A new feature or addition. label Dec 4, 2021
@JordanMartinez
Copy link
Contributor

Perhaps maybeT?

@thomashoneyman
Copy link
Member

We can rely on qualified imports to disambiguate, at least. I would expect the naming to be the same as is used for ExceptT, which would be to follow @garyb’s proposal for the name

@Quelklef
Copy link

👎 to both maybe and maybeT. When I see a function with the lowercase name of a type, I expect that function to be a destructor (bool, maybe, either, etc).

In Haskell this function is called hoistMaybe. Why doesn't that work?

If readability/succinctness is an issue, something like the following might work

class Hoist m n a | m -> a, m -> n where
  hoist :: n a -> m a

instance Hoist (MaybeT m) Maybe a where -- ...
instance Hoist (ExceptT e m) (Either e) a where -- ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

5 participants