The approach is an alternative to the traditional encoding of an object language as a (generalized) algebraic data type.
Questions tagged [tagless-final]
42 questions
0
votes
1 answer
Why is Either expected in the following for comprehension?
I am playing with tagless final in scala. I use pureconfig to load the configuration and then use the configuration values to set the server port and host.
Snippet
def create[F[_]: Async] =
for {
config <-…

nashter
- 1,181
- 1
- 15
- 33
0
votes
1 answer
Scala Tagless Final Without Specifying a Concrete Type
I have a Service that looks like this:
The Tagless final trait:
trait ProvisioningAPIService[M[_]] {
def provisionAPI(request: Request): M[Response]
}
And somewhere in my implementation, I have the following:
class ProvisioningService extends…

joesan
- 13,963
- 27
- 95
- 232
0
votes
1 answer
Akka Play guice bindings tagless final (TF) support
I have this binding to configure the Logger[IO] in my app (module with this line is in guice.conf file):
class CatsEffectModule extends AbstractModule with ScalaModule {
override def configure(): Unit = {
…

DenisNovac
- 621
- 2
- 8
- 15
0
votes
1 answer
Represent Task[Either] and IO[Either] as a single monad that includes tryCatch?
Is there a way to represent IOEither and TaskEither as a single Monad that will also include the tryCatch?
I currently will consume an API over HTTP, so it makes sense to use TaskEither, but anticipate that this code will migrate "closer to home"…

user1713450
- 1,307
- 7
- 18
0
votes
1 answer
Intellij IDEA cannot resolve symbol on implicits (scala tagless final)
I have some code using tagless final approach and found that Intellij IDEA couldn't recognize method from implicit class.
I have some type-classes here (Functor, Apply, Applicative etc.) and one implicit class FunctorOps with some helper methods for…

Boris Azanov
- 4,408
- 1
- 15
- 28
0
votes
1 answer
Write laws or unit test for tagless algebras
I have written two tagless algebras and I would like to write the laws for one of them.
The algebras are as follows:
@newtype case class Variable(v: String)
@newtype case class Value(v: String)
trait Environment[F[_]] {
def get(v: Variable):…

softshipper
- 32,463
- 51
- 192
- 400
0
votes
1 answer
The first final tagless approach
I am trying to use the first time tagless final pattern in Scala and struggling a bit.
I have the following algebras definition:
trait DbSetting[F[_]] {
def read(url: String, user: String, pw: String): F[DbParameter]
}
trait Environment[F[_]] {
…

softshipper
- 32,463
- 51
- 192
- 400
0
votes
1 answer
Interpreters for two polymorphic classes in one function
I have this polymorphic code (see this question) with generic monads for model and client:
import Control.Monad.Writer
class Monad m => Model m where
act :: Client c => String -> c a -> m a
class Monad c => Client c where
addServer :: String…

esp
- 7,314
- 6
- 49
- 79
0
votes
1 answer
Can't make simple tagless final example
I've read about tagless final and I think it's great. I wanted to build my own small example of this pattern and got the problem.
This is my code:
trait Calculator[F[_]] {
def sum(a: Int, b: Int): F[Either[Throwable, Int]]
def minus(a:…

faoxis
- 1,912
- 5
- 16
- 31
0
votes
1 answer
Higher kinded type and Tagless final
I'm trying to write a function that can take any tagless final trait and return F[String].
def apply[Api[F[_]]](implementation: Api[F[_]]): F[String] = ???
I don't understand why the above is not compiling.
The following works.
trait…

Joan
- 4,079
- 2
- 28
- 37
0
votes
1 answer
Context aware typeclasses
I'm working on some application which works with files on a hard disk. I have the following "entity":
final case class File(path: String)
final case class FileChecksum(f: File, checksum: Long)
I also have the following typeclass:
trait…

Some Name
- 8,555
- 5
- 27
- 77
-3
votes
1 answer
Do tagless algebra needs laws?
I read the wonderful blog from JOHN A DE GOES regarding to tagless final. In the section 5.Fake Abstraction, he has mentioned:
Unfortunately, these operations satisfy no algebraic laws—none
whatsoever! This means when we are writing polymorphic…

softshipper
- 32,463
- 51
- 192
- 400