Discord is now Scala’s main chat platform. Please join us at https://discord.com/invite/scala
@mdedetrich actually Haskeller were dealing with a problem that required final tagless, but it was a specific one, and then we found out about the broader benefits of the approach. Btw this problem is why Martin is (incorrectly, imho) still skeptical about final tagless: lifting monad transformers automatically. It's akin to thinking that the Web is useless because you have no need to create documents with links to share scientific articles at CERN: basically a fallacy that the reason something was created it's also the reason it still exists/is useful.
The same fallacy happens with IO
and laziness.
ReaderT
and a type level set to hold the algebras, but I found the mental overhead to be much higher than the boilerplate problem it was solving. I've learn to just accept a little bit of boilerplate in exchange for the explicit nature of the code.
HFunctor
has the wrong shape, I was aftfer FFunctor
FunctorK
~>
is?
A[_[_]]
, e.g. trait MyDbAlg[F[_]] { ... do stuff ...}
I actually am more with Martin on this one, I think that Monad Transformers are a terrible abstraction so I can see why he is skeptical
@mdedetrich Thats' not what I meant: I meant that even though mtl style
was born to solve a problem with transformers, it's very useful regardless, just like even though the Web was created to solve the problem of sharing scientific articles at CERN, it's now very useful regardless
HFunctor
exists in scalaz as compose https://github.com/scalaz/scalaz/blob/series/7.3.x/core/src/main/scala/scalaz/Functor.scala#L62-L66
HFunctor
would be useful if you have like a List[Option[Foo]]
and you want to map Foo
to Bar
mapT :: (Monad m, Monad n) => (forall a. m a -> n a) -> t m b -> t n b
this is from the MFunctor
lib (naming on this wildly varies)
FFunctor
(or FunctorK
in cats) is (* -> *) -> *
@mdedetrich agree to disagree :)
The benefit to complexity ratio of final tagless is excellent imho. But to each their own, no big deal