Skip to content

Separate initialization effect in the constructors #553

@LMnet

Description

@LMnet

Many of the components of the library have the constructor in the following form:

class Component[F]
object Component {
  def apply[F[_]: SomeConstraints]: F[Component[F]]
}

The problem with this form of a constructor is that the initialization effect and execution effect are the same effects. But in fact, they may be different. Moreover, they may have different constraints.

I suggest to change in 2.0.0 all these constructors to the following form:

class Component[F]
object Component {
  def apply[F[_]: ExecConstraints, G[_]: InitConsraints]: G[Component[F]]
}

This change will be especially helpful for the complex tagless final codebases which use multiple different reader-like effects in the same codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions