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

Some Foldable methods for Coyoneda can respect underlying structure more #23

Open
treeowl opened this issue Jan 9, 2016 · 0 comments
Open

Comments

@treeowl
Copy link
Contributor

treeowl commented Jan 9, 2016

In particular:

  foldr c n (Coyoneda k a) = foldr (c . k) n a 
  foldl f b (Coyoneda k a) = foldl (\acc -> f acc . k) go b a
  -- foldl', foldr', foldl1, foldr1 similarly
  toList (Coyoneda k a) = map k (toList a) -- but this is arguably worse than the default!
  length (Coyoneda _ a) = length a
  null (Coyoneda _ a) = null a

Unfortunately, I don't believe it's possible to do anything about fold, maximum, minimum, sum, product, or elem.

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

No branches or pull requests

1 participant