Discord is now Scala’s main chat platform. Please join us at https://discord.com/invite/scala
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
encoding languages as their interpreters
. e.g. Scalatags uses parametrization over F[_]
to render to either Strings, js.Element
s, or React VDom snippets. You compose a bunch of methods that return F[T]
, it returns a bigger F[T]
, and it looks just like any example of finally tagless that i've ever seen. Is Scalatags then finally tagless?
F[_]
because it has different sets of tags, e.g. the tags from scalatags.Text.TypedTag[T]
or scalatags.JsDom.TypedTag[T]
, and each tag is typed with the value returned when you render it)
sealed trait Op
case class Lit(i : Int) extends Op
case class Add(a: Op, b: Op) extends Op
Op
Add(Lit(1), Add(Lit(2), Lit(3))
A
for now
def lit(i: Int): A
def add(a: A, b: A): A
trait Op {
def lit(i: Int): A
def add(a: A, b: A): A
}
A
?
trait Op[A] {
def lit(i : Int): A
def add(a: A, b: A): A
}