<@U0B8ZP13Q> yes we have Free, FreeApplicative, Co...
# feed
r
@cedric yes we have Free, FreeApplicative, Cofree and many others in Kategory already and usable. Our type checked docs in Kategory are built with
ank
which is a markdown snippet evaluator based on
Free
: https://github.com/kategory/kategory/blob/master/ank-core/src/main/kotlin/io/kategory/ank/algebra.kt https://github.com/kategory/kategory/blob/master/ank-core/src/main/kotlin/io/kategory/ank/interpreter.kt
­čžÁ 4
4 thread request so here it goes. We have encoded Free monads and applicatives in http://kategory.io/ . Free monads and applicatives beside their FP jargon are useful data structures that allow you to decouple program declaration from interpretation.
Free algebras are defined as ADT, ops you can reify in a data structure that when you
flatMap
over it it builds the declaration of a program.
Once you write an interpreter which is a natural transformation from your ADT to a target runtime datatype you can interpret your program.
Those programs are stack safe by nature because the Free monad is also stack safe
You can save your entire program as a value and interpret it as many time as you wish to different runtimes.
All concerns of an application can be reified in terms of a free algebra so you can model error handling, effect capturing, dependency injection etc.
Biz logic stays entirely decoupled from API and integrations in the implementation.
There are no inheritance relationships or constrains as to how you combine your programs.
Entire frameworks and libraries in Scala build a top Free monads. For example slick and doobie for database access. Fetch for efitient data fetching over heterogeneous datasources and many more. http://frees.io as well which is from many of the Kategory contributors and sponsored by 47 Degrees.
We are porting a lot of those libs over to Kotlin
Because with Free structures you can inspect programs before running them and optimizing them so we can do things like dedup, batching, cacheing, etc... all thanks to
Free
and
FreeApplicative
If anybody wants any gore details about anything in particular I'll be happy to answer questions here or in #functional #kategory EOF.