Git Product home page Git Product logo

Comments (11)

etorreborre avatar etorreborre commented on May 20, 2024

I added the import to the example. Thanks.

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

Thank you for that, it doesn't seem to compile though.

from eff.

etorreborre avatar etorreborre commented on May 20, 2024

What is your compilation error? My example is compiling because the doc is generated from valid Scala code here.

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:5: not found: object all
[error] import org.atnos.eff., all.
[error] ^
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:6: object interpret is not a member of package org.atnos.eff
[error] import org.atnos.eff.interpret._
[error] ^
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:18: not found: type <=
[error] def future[R, A](a: => A)(implicit m: Fut <= R): Eff[R, A] =
[error] ^
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:19: not found: value send
[error] send[Fut, R, A](Future%28%28%29 => a%29)
[error] ^
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:24: not found: type Recurse
[error] val recurse = new Recurse[Fut, U, A] {
[error] ^
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects/Effects.scala:28: not found: value interpret1
[error] interpret1((a: A) => a)(recurse)(effects)(m)
[error] ^
[error] 6 errors found
error Compilation failed
[error] Total time: 0 s, completed 19-Apr-2016 20:04:38
4. Waiting for source changes... (press enter to interrupt)
[info] Compiling 2 Scala sources to /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/target/scala-2.11/classes...
[error] /Users/pavlos/Workspace/habito-deployment/slib/habito-effects/src/main/scala/habito/effects.scala:3: not found: type Effects
[error] package object effects extends Effects
[error] ^
[error] one error found
error Compilation failed
[error] Total time: 0 s, completed 19-Apr-2016 20:05:10
5. Waiting for source changes... (press enter to interrupt)

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

These are the errors if I copy and paste the snippet as it is

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

Now my code is like this

import scala.concurrent.{Await, ExecutionContext, Future}
import cats.data.Xor
import org.atnos.eff._
import Eff._
import Member._
import Interpret._

import scala.concurrent.duration.Duration

trait Effects {

  object FutureEffect {
    type Fut[A] = Future[() => A]

    def future[R, A](a: => A)(implicit m: Fut <= R, ec: ExecutionContext): Eff[R, A] =
      send[Fut, R, A](Future(() => a))

    def runFuture[R <: Effects, U <: Effects, A]
    (
      atMost: Duration
    )
    (
      effects: Eff[R, A]
    )(
      implicit m: Member.Aux[Fut, R, U],
      ec: ExecutionContext

    ): Eff[U, A] = {

      val recurse = new Recurse[Fut, U, A] {
        override def apply[X](m: Fut[X]): Xor[X, Eff[U, A]] =
          Xor.left(Await.result(m.map(_ ()), atMost))
      }

      interpret1[R, U, Fut, A, A]((a: A) => a)(recurse: Recurse[Fut, U, A])(effects)(m)
    }
  }

}

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

The error here is
type arguments [R,U,habito.effects.Effects.FutureEffect.Fut,A,A] do not conform to method interpret1's type parameter bounds [R <: org.atnos.eff.Effects,U <: org.atnos.eff.Effects,M[_],A,B]
[error] interpret1[R, U, Fut, A, A](%28a: A%29 => a)(recurse: Recurse[Fut, U, A])(effects)(m)
[error] ^
[error] one error found

from eff.

etorreborre avatar etorreborre commented on May 20, 2024

Is this a public project I could have a look at?

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

Sorry it's not, but the snippet I pasted should be enough, is it not?

Thank you
On 19 Apr 2016 21:20, "Eric Torreborre" [email protected] wrote:

Is this a public project I could have a look at?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#4 (comment)

from eff.

etorreborre avatar etorreborre commented on May 20, 2024

Those errors seem to correspond to the latest code which was not yet published. Please try version 1.4 which I just published now.

from eff.

pavlosgi avatar pavlosgi commented on May 20, 2024

Thank you

from eff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.