-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
type of Z.of #3
Comments
What if we could represent actual Type ( // safeFoldMap :: (ChainRec F, Monoid F, Applicative F) => F -> SomeStructure a -> F a
// or
// safeFoldMap :: (ChainRec F, Monoid F, Applicative F) => F _ -> SomeStructure a -> F a
const safeFoldMap = (F, x) => {
...
// here we can call F.chainRec, F.of, F.empty
...
return res
}
safeFoldMap(Maybe, data); I have also commented of FL#164 about this idea |
That would be very nice, @safareli, but the FL spec doesn't require Type values such as I think the spec should require a Type value to be defined. |
I agree. It makes the most sense for the type dictionary to exist on the type itself, and not on the instances directly (although it could also be both if somebody chose to implement it that way). I like signature 2. I don't think it should be implied that an instance is already needed in order to create an instance. |
I've updated #2. Please have a look at the change and let me know your thoughts. :) |
👍 looks good! |
What's the appropriate type of
Z.of
? There appear to be two options:The advantage of the first option is that given
Applicative f => f a
we can find theof
function in either of the valid locations:With the second option the caller would need to do this work:
We shouldn't optimize for the case in which we already have a value of the type, though. After all, the purpose of
of
is to allow us to create values of the type so we shouldn't need to create a value of the type in order to create a value of the type! Thus the second option seems more sensible. Do others agree?Whatever we decide here should determine the type of
Z.chainRec
as well.Z.empty
is a different matter because anempty
method is strictly more powerful than anempty
function (though this will no longer apply if and when fantasyland/fantasy-land#164 is merged).The text was updated successfully, but these errors were encountered: