Git Product home page Git Product logo

Comments (12)

reactormonk avatar reactormonk commented on June 1, 2024

This looks more like a stackoverflow question, could you post the link to the question here?

from eff.

etorreborre avatar etorreborre commented on June 1, 2024

There are 2 compiler plugins which are necessary for compilation:

// to write types like Reader[String, ?]
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")

// to get types like Reader[String, ?] (with more than one type parameter) correctly inferred
// this plugin is not necessary with Scala 2.12
addCompilerPlugin("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.2.0")

If you want to compile with Intellij you probably have to specify those plugins:
image
image
(but as you can see I am not using Intellij to build my projects :-)).

from eff.

russellcameronthomas avatar russellcameronthomas commented on June 1, 2024

@reactormonk I considered Stackoverflow because I'm probably missing something basic, but my question is specific to the content of this tutorial. In my opinion, tutorials should provide enough information for anyone to run them, even novices.

from eff.

russellcameronthomas avatar russellcameronthomas commented on June 1, 2024

@etorreborre Here is my build.sbt file. As you can see I include those compiler plugins. I still get the error.

name := "Tutorial"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.typelevel" %% "cats" % "0.9.0"

libraryDependencies += "org.atnos" %% "eff" % "3.1.0"

// to write types like Reader[String, ?]
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")


// to get types like Reader[String, ?] (with more than one type parameter) correctly inferred
// this plugin is not necessary with Scala 2.12
addCompilerPlugin("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.2.0")

from eff.

russellcameronthomas avatar russellcameronthomas commented on June 1, 2024

@reactormonk I posted a question on Stackoverflow here: http://stackoverflow.com/questions/42894647/converting-tutorial-to-a-running-program-in-intellij-idea

from eff.

edmundnoble avatar edmundnoble commented on June 1, 2024

@russellcameronthomas I pasted your program into ammonite shell and it worked just fine. I don't know how you're building your project, but I highly suggest you ditch IntelliJ (for builds) because of issues like this one exactly. The reason why IntelliJ cannot figure out your code in particular looks to be because IntelliJ is not capable of simulating implicit-directed type inference; the Member implicits have a type member, Out, inside them which represents the remaining effect stack. If the IDE cannot figure it out, it subs in a fresh type variable and thus the run ops constructor cannot be called because the inferred type according to IntelliJ is Eff[m.Out, A] and not Eff[NoFx, A].

More to the point: you can fix this by calling eval.runEval instead of postfix runEval and supplying the type arguments. But it won't be pretty. And it might end up requiring that you add the type arguments to every runX call.

from eff.

russellcameronthomas avatar russellcameronthomas commented on June 1, 2024

@edmundnoble Thanks for all this info.

Yes, your explanation makes sense, at least to the degree that I understand "implicit-directed type inference".

Regarding your "fix", can you post the exact code? At this point, I don't care at all about being verbose or adding boilerplate. What I care about is getting code that runs, so I can learn from it through incremental modifications.

As for "building my project", I entered the build.sbt file, as shown, and then I clicked the "run" button in IntelliJ-IDEA.

from eff.

russellcameronthomas avatar russellcameronthomas commented on June 1, 2024

@etorreborre @edmundnoble

I have resolved my problem -- to a degree.

The IDE still shows the error highlighted, as described above.

But instead of directly running the App object, I clicked Recompile Tutorial.scala from the Build menu. It successfully compiled and ran successfully.

I'm not happy about this, but at least it runs.

Thanks for your help.

@etorreborre : It would be nice if you added a paragraph or two to your Tutorial on "How to run the Tutorial in an IDE"

Context: One of my strong values is that we should be helping novices not just experts in what ever language, libraries, and tools we are using. When I write tutorials (e.g. Probabilistic Programming http://library.meritology.com) I do my best to serve novices as well as experts.

from eff.

etorreborre avatar etorreborre commented on June 1, 2024

@russellcameronthomas I am glad you found the issue to your problem.

I must also say that my open-source time is fairly limited. For instance I spent a good chunk of my week-end reworking interpreters to make them easier to understand in the next release. I would love to have more time to add more detailed tutorials but there's only so much I can do as an individual 😸 (this is not my only open-source project). So please if you like the library and think the doc should be expanded, make a PR, the 2 paragraphs should probably be added here.

from eff.

etorreborre avatar etorreborre commented on June 1, 2024

@russellcameronthomas btw the intellij issue you see about highlighting is something I frequently get with "type-aware" highlighting. I have been unchecking this option for at least the past 3 years now :-(.

from eff.

reactormonk avatar reactormonk commented on June 1, 2024

@russellcameronthomas Ah ok, the issue was the assumption that when intellij tells you something doesn't compile, it won't - I just skip directly to the underlying scala compiler and wouldn't call it "it doesn't compile" but "intellij doesn't think it compiles".

from eff.

etorreborre avatar etorreborre commented on June 1, 2024

I am closing this for now, I hope the current issue + the paragraph added by @reactormonk will help. Let's re-open if that's not the case.

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.