4
votes

I've been reading some materials on free monads and I don't really think I'm much closer to implementation but I think I am closer to understanding what they are!

Given a lot of the above resources, what I understand is that free monads "free" the "monad" (which is a data type) from the "computational" work. In other words free monads provide the interface for things like join and map which the client will implement themselves?

1
"Free" is an adjective, meaning an object is the minimal object with the properties of the structure being discussed. So a free monad is the "simplest" thing that is a monad; it has no other discernible properties other than what is required to be a monad. Given data Free f r = ..., as long as f is a functor, then Free f is a monad, without having to consider exactly what f is.chepner

1 Answers

2
votes

In other words free monads provide the interface for things like join and map which the client will implement themselves?

In a way yes. But I think a better way to say this is: "a free monad provides a language while its instances implement different interpreters of that language."

The monad is free because it is not constraint in any other way than by the monads laws. Its instances are not free as specific interpretations add additional constraints.