Skip to content

re-add Alternate newtype #50

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

Merged
merged 1 commit into from
Jul 17, 2018
Merged

Conversation

Thimoteus
Copy link
Contributor

Since the merge of the deprecated monoid lib into Prelude, all the newtypes except this were kept. This can't fit in the prelude, because Alt exists here.

@Thimoteus
Copy link
Contributor Author

Thimoteus commented Jul 16, 2018

Hmm, I just realized that since control doesn't depend on newtype it's not possible to do ala Alternate foldMap. In fact, it's not possible to do that with any of the newtypes from the old monoid library (though this is a seperate issue).

append (Alternate a) (Alternate b) = Alternate (a <|> b)

instance monoidAlternate :: Plus f => Monoid (Alternate f a) where
mempty = Alternate empty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be super nitpicky, but can you put an empty newline at the end of the file too please?


derive newtype instance eqAlternate :: Eq (f a) => Eq (Alternate f a)

derive newtype instance ordAlternate :: Ord (f a) => Ord (Alternate f a)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add Eq1 and Ord1 instances while we're here? You should be able to derive them I think, with Eq1 / Ord1 constraints on f.

@Thimoteus Thimoteus force-pushed the alternate-newtype branch from d7822b7 to a5c1b6e Compare July 17, 2018 01:34
@Thimoteus
Copy link
Contributor Author

Updated

@garyb
Copy link
Member

garyb commented Jul 17, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants