-
Notifications
You must be signed in to change notification settings - Fork 65
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
instance Foldable f => Foldable1 (Cofree f) #157
Comments
I want a more elegant solution to this, but the instance makes sense: |
Just freely lift the semigroup to a monoid using instance Foldable f => Foldable1 (Cofree f) where
foldMap1 f (a :< as) = case getOption $ foldMap (Option . Just . foldMap1 f) as of
Just b -> f a <> b
Nothing -> f a |
That compiles smoothly and answers my question, I imagine the same can be written for Should this be added? |
FYI scalaz/scalaz@a05ab2c in scalaz |
What's the status of this? @ElvishJerricco Would you take a PR for weakening the |
I wondered if the constraint on
Foldable1 (Cofree f)
could be weakened, this is my attemptThe text was updated successfully, but these errors were encountered: