functional.cafe is one of the many independent Mastodon servers you can use to participate in the fediverse.
functional.cafe is an instance for people interested in functional programming and languages.

Server stats:

213
active users

Just ~90 minutes until the start of episode 16 of The Unfolder. This time about some Haskell history (the Applicative Monad Proposal), a recent Mastodon thread by @MartinEscardo , and about DerivingVia!

youtube.com/watch?v=tnCHrPZk8x

Public

@kosmikus

Nice!

You explained how to make the new world to accommodate the old world.

But what if back in 2015 people wanted to use Classical Monads with Functor and Applicative, without changing the ghc library for monads/applicative/functor?

Could this new technology you discussed today be used for that, if it were available at that time? So that we could still have the classical definition of monad today and at the same time please people who wanted to make the change?

Public

@MartinEscardo I am dreaming of a time when we don't have superclasses anymore in the way we currently do and just have "rules" that state "we can create an X instance out of ..." which are getting invoked. Unfortunately, it is still a dream, because practical concerns remain: there's an implementation aspect of superclasses (they're just projected out of the dictionary, so you know they're cheap to compute), and there's a constraint simplification aspect, because you can just write `Ord a` rather than having to write `Eq a, Ord a`, because you *know* `Ord a` really implies `Eq a` in all cases. I don't think these things are insurmountable, but I don't have a research job these days, so I don't have a whole lot of time to work on it.

So to answer your actual question: DerivingVia could have used by saying "here's a quick way to give you Functor / Applicative instances for a type that already has a Monad instance such that they're compatible, even without making Applicative a superclass". I think that e.g. for me, that would probably have been good enough. But as superclasses are somewhat special (see above), the discussion in principle still remains, and we'll probably have more such discussions in the future (selective applicative functors were mentioned in the chat, but there are other examples).

Public

@kosmikus

Can I ask you for one more thing?

I provided, in my original thread, a proposal (to myself) of how to teach monads next time.

Then you improved this in your talk.

Would you be willing to post a concise counter-proposal in that thread, based on your talk, in the style of my proposal? (And then link to the talk for a full explanation.)

I think it would be nice to have this explicitly recorded for future reference.

Public

@MartinEscardo Will try to do this tomorrow.