4 ms·
>Honestly I think the differences in that example are pretty superficial. For most instances the difference is superficial, but for some problem domains the di
by sfvisser 12y ago
>Honestly I think the differences in that example are pretty superficial.
For most instances the difference is superficial, but for some problem domains the difference can have a pretty big impact.
All of this is because Applicative composition (using apply) statically guarantees there is no data dependencies between the (possibly) effectful computations. Monadic composition (using bind) can (but might not) introduce a data dependency which can only be reasoned about at runtime.
Facebook's Haxl project is an interesting example of this: http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/simon.pdf http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/simon.pdf