Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Free interpreters for all algebras #36

Open
mr-calvert opened this issue Jan 6, 2018 · 1 comment
Open

Implement Free interpreters for all algebras #36

mr-calvert opened this issue Jan 6, 2018 · 1 comment

Comments

@mr-calvert
Copy link
Owner

  1. Write a Reification trait, parameterized on IO[[]], F[_] and A (return type), returning an F[A] and taking an implicit IO. The method calls the appropriate IO operation with stored parameters.
  2. Implement XXXF sealed traits for every algebra. (XXX is part before the IO in the algebra, so File for FileIO). Each XXXF trait extends Reification and is implemented by one case class per operation in the algebra.
  3. Write an Embed typeclass with a single operation that takes a Reification instance and wraps it in some F[_]. Cannonically that would be a Free instance, but hey, there are other options. There are also two different libraries providing Free, so...
  4. Write a finally tagless interpreter for each algebra which generates the appropriate F instance. Each interpreter will take an Embed instance and use it to wrap each F.
@mr-calvert
Copy link
Owner Author

Emed renamed to Lift, Reification renamed to Term.

Had to work around the lack of kind polymorphism because of Terms that produce other algebras and need to fill in the F[_] on the returned algebra. Lots of type lambdas now.

Creation of Scalaz and Cats integrations are being deferred to other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant