question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apply ?= Applicative, Chain ?= Monad

See original GitHub issue

I’m a little confused here.

Is there any Functor that doesn’t have a .of function? Isn’t that just a constructor?

Just.prototype.of = function(x) {
  return new Just(x)
}

By this logic, an Apply is an Applicative and a Chain is a Monad.

Are there any good examples of data structures that are particularly only some of these categories, but not all of them?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
puffnfreshcommented, Mar 29, 2016

I just remembered that there’s a blog post with some examples, too: http://blog.functorial.com/posts/2015-12-06-Counterexamples.html

1reaction
ccorcoscommented, Mar 28, 2016

Where would it get the string? That’s the fundamental problem.

I see. So .of can take only a single parameter. And that parameter must be a basic type? Well what is a basic type? For example, what if you passed an array of two items in Pair.of(['foo', 7])?

What I’m really struggling with is discriminative examples. I finally understand how all this stuff works in regards to Maybes and Arrays, but thats because they work for just about all of them. But what are some examples that discriminate between these categories well?

  • whats a semigroup that isn’t also a monoid?

  • whats a foldable that isn’t also a traversable?

  • whats an functor that isn’t also an apply?

  • whats an apply that isn’t also an applicative?

    A pair is an Apply (you can bias map and ap to the right value), but it is not an Applicative because you can only pass one value (and any value) into .of and even if its just the right value, it will not pass the interchange law.

  • whats an apply that isn’t also a chain?

  • whats a chain that isn’t also a monad?

  • what an applicative that isn’t also a monad?

I’ve been trying to find answers to these all damn week! Any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Your easy guide to Monads, Applicatives, & Functors - Medium
Monad, applicative functor, and functor are just functional programming patterns you can use to deal with effects like lists/arrays, trees, ...
Read more >
Applicative Functors - Monday Morning Haskell
Applicative functors are the second step to understanding monads. They build on our knowledge of normal functors and gives us a little more...
Read more >
Control.Applicative - Hackage - Haskell.org
This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads ...
Read more >
Chapter 10: Applicative Functors - mostly-adequate-guide
We can chain and then map the partially applied add(2) like so: ... If we can define a monad, we can define both...
Read more >
Functors, Applicatives, And Monads In Pictures - adit.io
fmap shows us how it's done! But how does fmap know how to apply the function? Just what is a Functor, really? Functor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found