-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix alt for ZipList #150
fix alt for ZipList #150
Conversation
Seems reasonable to me. Anyone else? |
src/Data/List/ZipList.purs
Outdated
@@ -46,7 +47,7 @@ instance applicativeZipList :: Applicative ZipList where | |||
pure = ZipList <<< repeat | |||
|
|||
instance altZipList :: Alt ZipList where | |||
alt = append | |||
alt (ZipList xs) (ZipList ys) = ZipList $ (xs <> drop (length xs) ys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary $
, or unnecessary parens.
Can you describe what is being fixed here? Also, do you have a proof that this version satisfies all the relevant laws? |
Also won’t this diverge if the first argument is infinite? |
Ah ok, so I presume this is motivated by the fact that the current version doesn’t satisfy the Alternative distributivity law
since with the current instance, the left hand side will be a list of length |
I'm going to merge this momentarily, just as soon as I've written a satisfactory commit message |
No description provided.