-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Inconsistency in protocol realisations for sequential collections #17
Comments
Hi Alex. Thank you for taking time to write a detailed comment. I think there is a flaw in your proof. If I understood correctly, you put it as:
I must admit that I don't think that 3 follows from 1 and 2. Actually, the strategy in your proof is one of most common proving strategies in mathematics (as far as I remember), but I would say that the real conclusion should be: a or b (or both) is not true. And, indeed, a and b are not. So, your proof demonstrated that:
|
Thank you for your response, however you completely missed my point.
|
If you'd provide an implementation that is better than existing, I'll be glad to consider including it in fluokitten. |
Great! I was going to provide such a realisation anyway, but I'll always On Tue, Dec 16, 2014 at 8:34 PM, Dragan Djuric notifications@github.com
|
I made changes we discussed in a fork. Here is a changelog: https://github.com/adavydow/fluokitten/blob/master/CHANGELOG.md. What do you think about changes like this? |
I discussed variadic fmap in the first response and do not agree with your argumentation. Not only the changes are breaking, but the three conditions you mention in the changelog are pulled from thin air - all existing fluokitten implementations satisfy all functor, applicative and monadic laws already. Also, you just removed many tests that started failing once you introduced the changes. Having said that, nothing should stop you from releasing the library that is suited to your liking, but please do not call it Fluokitten, and do not use Fluokitten's versioning since that will cause confusion with users when I release version 0.4.0. |
ok On Sat, Dec 20, 2014 at 12:31 PM, Dragan Djuric notifications@github.com
|
Using 'fmap' as variadic function requires instance of Applicative. Proof: you can define 'fapply' as (partial fmap apply) and '(pure x)' as (fmap #(identity x)) (it is impossible to write this realisation of 'pure' in clojure due to the absence of return-type polymorphism). Looks like this point was discussed in Issue Multiarity fmap is no longer fmap #12 .
Lists and other sequentional collections can be instances of Applicative and Monad in two different ways: as fixed-size vectors with componentwise operations, and as an undetermenistic computation (undetermenistic computation is more common and it is a default behaviour in Haskell):
If variadic 'fmap' and 'fapply' are defined independently, then inequality
(not= (fmap apply [inc dec] [1 2]) (fapply [inc dec] [1 2])) is an unexcpected behaviour from my point of view.
And in the case of sequentional collections (i) is chosen for 'fmap' and (ii) for 'fapply'.
Every Monad has an inherited Applicative Functor structure, but in the library Monad and Applicative protocol realisations for sequential collections are incoherent (see (2)) which is an unexpected behaviour from my point of view.
The text was updated successfully, but these errors were encountered: