Cats: Should we rename Coyoneda?

Created on 16 Oct 2015  路  12Comments  路  Source: typelevel/cats

@ceedubs introduced a Coyoneda into a project here at $work and got some snide comments about "what language is this?". it got us talking about whether or not we should consider renaming Coyoneda to FreeFunctor, which might be a little less "scary" to people less familiar with these concepts.

Cody quickly remarked that he would then want to also rename Free to FreeMonad for consistency.

how do people feel about this one?

question speculative

Most helpful comment

Can we rename List to FreeMonoid?

All 12 comments

I definitely support renaming Free to FreeMonad. There are many _free_ constructions and I don't think it necessarily makes sense to privilege monads here.

I just wanted to comment that the difference between specific monads (like FreeMonad) and type-classes like MonadError is a little confusing without prior knowledge.

Can we rename List to FreeMonoid?

@tpolecat and alias String to FreeMonoidOverChars ?

And NonEmptyList to FreeSemigroup. But seriously, I too support Free -> FreeMonad

Do you all think using aliases makes sense here?

I'm not sure I support forcing people to stop using the Coyoneda name. For one thing, if someone is working with Yoneda that is also a _free functor_. For another thing, the relationship between Yoneda and Coyoneda (and the _Yoneda Lemma_) might be useful to highlight, which those names (whatever else they are) do a good job of.

In some ways, providing a type alias (and a companion object alias as a val) might allow folks in this kind of situation to use a less esoteric name at work, while allowing others to continue as they are. But maybe that doesn't really help things? For one, documentation will have to choose one name or the other, so an alias might be even more confusing.

I vote for leaving things as-is (i.e., Yoneda/Coyoneda and Free/Cofree).

Using standard, easily searchable names seems a lot more beginner-friendly to me than using something non-standard and less precise. I also think type aliases for things like this just add to the confusion.

I would vote for renaming Free to FreeMonad, though.

:+1: to everything @travisbrown just said. I think the alias would be more confusing than either name.

If there were an alias, which one would be the "standard" name? (appearing in error messages)

I think my $work would understand FreeFoo more readily. When I was learning, the "Free" monad and Coyoneda were pretty meaningless; even after I kind of got Coyoneda thanks to @puffnfresh's post about Set, it wasn't until hearing about the free monoid in one of @runarorama talks that all three really clicked for me, and I think for coworkers as well when I retold it.

But I mainly came to say I'm jealous of @stew and @ceedubs now that I know they both work someplace with multiple cats contributors.

Just to comment on @hakuch's concern about confusion with type classes... it's not entirely unwarranted to think of the free monad as a type class. It's not one specific monad, but a whole class of monads, namely the monads that admit a homomorphism to any other monad.

Also, @refried, you should come work with us.

I think that now that we are past a 1.0 release it would be a hassle and _more_ confusing to make any of these name changes now. I'm going to go ahead and close this out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterneyens picture peterneyens  路  5Comments

fosskers picture fosskers  路  3Comments

alexandru picture alexandru  路  4Comments

julien-truffaut picture julien-truffaut  路  3Comments

LukaJCB picture LukaJCB  路  3Comments