Comments (5)
The definition of ap
is done to keep consistency with the typeclass definition for Applicative
, and the behavior of ap
is not the same as in <*>
. If we check the signature for both:
ap : (F<A>, F<(A) -> B>) -> F<B>
<*> : (F<A>, F<B>) -> F<(A) -> B>
<*>
definition, and the usage you are proposing, is encoded in Bow as product
in the Applicative
typeclass, and the way you could be using it is:
Option<Int>.applicative().product(one, two).fix().map(add)
The syntax could be better but it is a matter of getting to the point where the language supports higher kinded types natively.
from bow.
It may be a language barrier thing, but you have me a bit confused. You don't have <*>
defined at all in Bow, so there's no signature to compare your ap
with. You've also mentioned deprecating operators, so I assume <*>
isn't being added?
In Haskell, ap
is on the Monad
typeclass and is defined with the exact same infix way as <*>
(though with different type class constraints):
ap :: m (a -> b) -> m a -> m b
<*> :: f (a -> b) -> f a -> f b
So is it fair to assume that you want Bow's type classes to be consistent with Arrow's? That can definitely be a project prerogative, though porting over a language limitation is unfortunate.
from bow.
Sorry, I think I misunderstood it on my first read. You are right; in fact, in Cats for Scala this is reversed as well. Since your approach is more readable in Swift, we can refactor it for the sake of the usability. Our aim is to maximize compatibility with Arrow, of course, but in some cases like this, a more Swiftier approach is preferrable. I'll add this to my pipeline and perform the change in the next few days.
from bow.
@stephencelis please, take a look at the changes in #80, addressing the improvement you suggested here.
from bow.
#80 is merged and this will be in the next release.
from bow.
Related Issues (20)
- Zipper API Reference
- ["Bug"] Optics docs cannot be loaded HOT 1
- ["Request"] or combinator for Prisms HOT 1
- ["Request"] Add extract and embed properties to Prism HOT 1
- ["Request"] Improve binding with function builders HOT 3
- ["Request"] Tree data type HOT 3
- ["Bug"] I lost `BowGeneric` Modules HOT 4
- Documentation for simulated rank-n polymorphism (aka documentation on FunctionK) HOT 4
- ["Request"] Monad, Applicative and Functor instances for Trampoline HOT 6
- ["Request"] Add conversion from Foldable to ArrayK HOT 1
- ["Bug"] Free foldMap is not stack safe HOT 2
- ["Request"] Pair type HOT 1
- ["Request"] Simulation for derive (generic programming) HOT 4
- ["Request"] StackSafeMonad HOT 1
- ["Request"] New syntax for partial application HOT 6
- Question: How to connect Lens which has optional value? HOT 2
- Question: How to convert ReaderT to different F? HOT 4
- Question: Easier flatMap api for ReaderT? HOT 2
- Migrate from Rx to Combine
- Project status HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bow.