channable / hoff

A gatekeeper for your commits
Apache License 2.0
41 stars 3 forks source link

Rewrite Free monads to Effectful #217

Closed FPtje closed 1 year ago

FPtje commented 1 year ago

Description

This (somewhat large) PR rewrites Hoff from using effects to using effectful. This is mostly an exercise for me to personally get familiar with the library, but I think it's worth considering a merge.

Why prefer effectful over free monads?

Hoff uses Free monads quite well, which makes it a perfect example for comparison against effectful. In that comparison, I think effectful comes out on top:

Why rewrite?

Under normal circumstances, I would argue quite strongly that rewriting is a bad idea. In this case, this is a Hobby project, one that I would also like to use to advocate for the effectful library, and to teach the differences between free and effectful. The really nice thing here is that this is a PR where the left side shows all the implementation specifics of free, and the right side shows that of effectful.

For this purpose I will also write a bunch of review comments. This documents the differences, and also makes the job of a reviewer easier.

Testing

This PR has been tested as follows:

Since semantics didn't change, and above tests passed the first try, I'm confident this PR will not negatively affect Hoff's performance.

FPtje commented 1 year ago

Thanks everyone for the review! Let's merge!

@OpsBotPrime merge

OpsBotPrime commented 1 year ago

Pull request approved for merge by @FPtje, rebasing now.

OpsBotPrime commented 1 year ago

Rebased as fc89ccd788334f2c56212d4ef3d4e9fe1acc845c, waiting for CI …

OpsBotPrime commented 1 year ago

CI job :yellow_circle: started.