Overlapping instances error for Yesod and EclipseFP application - eclipse

I created an application with EclipseFP, the yesod application. With the out of the box settings, I get an error when I try to run a 'main.hs' file. It looks like it compiles but when I try to run I get the error. I attempted to run by 'right clicking' and then 'run'. The console opens:
What might be the issue?
Here is the error:
<command line>:
Could not find module `OverlappingInstances':
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Prelude> main
Version: Indigo Service Release 2
Eclipse FP Haskell Plugin - 2.2.4
GHC version 7.0.3
Possible solutions:
I tried to add '{-# LANGUAGE OverlappingInstances #-}' at the top of all of the haskell files

This is a bug, I've fixed it in the github version of EclipseFP/BuildWrapper. Will be part of the 2.3.0 release of EclipseFP. We're getting the wrong options from the cabal file and pass OverlappingInstances to GHCi without the -X. Sorry!

Related

intelliJ multiple scala-library*.jar file

I tried to run scala app in IJ community version 2018.3.6, and ran into this error:
Error:scalac: Multiple 'scala-library*.jar' files (scala-library-2.12.8.jar, scala-library-2.12.8.jar) in Scala compiler classpath in Scala SDK sbt: org.scala-lang:scala-library:2.12.8:jar
and I checked hte .idea/libraries folder saw:
sbt__org_scala_lang_scala_library_2_11_8.jar.xml
sbt__org_scala_lang_scala_library_2_12_8.jar.xml
after I delete sbt__org_scala_lang_scala_library_2_11_8.jar.xml still got the same error, then i deleted all 2.11.8 scala*.files still got hte same error
I also tried to open the same project in IJ community version 2019.2.4, it complained:
Cannot determine module type ("SBT_MODULE") for the following module:
there is no 'sbt' tool listed in Preference -> Build, Execution, Deployment -> Build Tools
anyone know how to get it work?
## FIX
i ended up to uninstall and reinstall Scala plugin in IJ 2019.2.4 to get it working again.

Error importing SBT project in IntelliJ / no src folder appears

I'm new to working with both IntelliJ and Scala, so I've been trying to set up a basic HelloWorld project using it. However once I try to load the project I'm met with two problems
I get an error saying there was an "Error while importing SBT project"
No 'src' folder appears on the project tree
I've seen similar problems here and here, but I still can't get the project to load properly.
For some reason this site doesn't let you post an image until you have 10 reputation, so here is a link to the error message I'm receiving http://i.imgur.com/vDZB6SA.png.
From the looks of it, it seems like it's unable to download the necessary dependencies, however I was able to download the scala plugin earlier, so I can't see why there would be a problem now.
I tried following the advice here on updating the proxy settings, but that doesn't work either.
Has anyone encountered a similar problem? I'm really stuck here on how to proceed.
EDIT 1:
Details on IntelliJ
IntelliJ IDEA 2016.2.3
Build #IC-162.1812.17, built on August 30, 2016
JRE: 1.8.0_65-b17 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
Setting up the proejct:
I just followed an example and went to New Project > Scala > SBT > name project and finish. Then once it loads I get the error displayed in the picture above. The SBT version is 0.13.8 and the Scala version is 2.11.8

Scala Compiler doesn't compile in ScalaIDE

I'm trying to develop on the Scala compiler project with the help of ScalaIDE. I followed this guide to set up the development environment. When I now try to build the mentioned projects, the reflect project won't get built. Instead, I get the following error via the console output:
uncaught exception during compilation: scala.reflect.internal.MissingRequirementError reflect Unknown Scala Problem
Having tried the provided ANT script of the project via the console, everything seems to work fine.
Does anyone know if I'm missing a hidden compiler flag, dependency or something like this?
Thanks!
With the IDE for Scala 2.10 you can only build the 2.10.x branch of the Scala compiler. If you want to work on master, you need to install a 2.11-based version of the IDE. We don't publicise IDE for 2.11 nightlies yet, but they are available at:
http://download.scala-ide.org/nightly/scala-ide-master-2.11.0-SNAPSHOT/

Scala plugin for IntelliJ IDEA 10 not detecting simple errors?

I know I must be missing something, but can't figure out what. When I create a scala project, following the scala-plugin instructions, not a single syntax error is detected. For example:
object MyApp {
val aNumber: Int = "hello"
}
does not detect any error. If I right-click and ask it to compile, then I get the expected type mismatch error from the scala compiler. This is just a silly example, no syntax errors are being flagged. For regular Java projects it works fine, so it must be scala specific.
I have a clean install of IDEA 10 CE on a OSX 10.6 and Scala 2.8.1 final. I have set up the jdk in the project settings as well as the scala home when creating the project. I have the latest version of the plugin (12/2010).
Any hint on what I'm missing?
You have to enable error highlighting. Turn on Settings/Code Style/Scala/Other settings/Enable experimental error highlighting
Works here too (IntelliJ 10.0.1, Scala 2.8.1, OpenJDK, Ubuntu 10.10 64bit).
If you want more type checking you can also tick "Enable experimental error highlighting (possibly shows many wrong red code)" in the Settings, but this shouldn't make a difference in your case, although it works perfectly in my case for a large code base.
In project structure > modules > [your project name] > dependencies tab, do you have scala-compiler-[some version] listed?
See the Exploring the Project Structure here
intelliJ IDEA 10.0.1 + scala 2.8.1 on Ubuntu 10.10 64bit.
It shows a type mismatch error
For 2019.1 CE on Mac OS:
Preferences | Build, Execution, Deployment | Compiler | Scala Compiler
Checked the option:
Features->Experimental Features

noClassDefFoundError using Scala Plugin for Eclipse

I successfully implemented and ran several Scala tutorials in Eclipse using the Scala plugin. Then suddenly I tried to compile and run an example, and this error came up:
Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloWorld
Caused by: java.lang.ClassNotFoundException: hello.HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
After this point I could no longer run any Scala programs in Eclipse. I tried cleaning and rebuilding my project, closing and reopening my project, and closing and reopening Eclipse.
Eclipse version number 3.5.2 and Scala plugin 2.8.0
Here is the original code:
package hello
object HelloWorld {
def main(args: Array[String]){
println("hello world")
}
}
If you see this when you attempt to run as a Scala application then the most likely explanation is that your project didn't compile and no class files were generated. Please check whether or not that's the case: look in your project's output folder for hello/HelloWorld.class.
If your project didn't compile that could either be because there's an error which you've missed (and if this error isn't being reported in the Problems view that could be a bug, in which case please open a ticket on Trac) or because you've turned off automatic builds and not done a manual build of your project.
I had the same problem. Project doesn't compile but there are no errors highlighted and AFAIK the code is OK. It seems to be a problem with the Run Configurations.
Solution 1: Delete the existing Run Configuration for your object and create a new one
Solution 2: Create a new object and cut / paste all your code into that file
When running "clean" does not un-hose Eclipse, I next try saving my work, exiting Eclipse, and re-starting. That usually gets things going again, but not always. A few times I've had to update the Scala plugin with a more recent version (I'm using the latest nightly), to get things working again. I doubt that this worked because the new plugin happened to fix the bug, but rather expect that loading the new plugin gives the whole Eclipse-Scala
system a "total reset" that gets it unhosed.
I was getting this problem in a project that combined .java & .scala files.
The solution for me was:
Remove all .java files
Edit the scala code as needed so it compiles without them.
Add the .java files back in.
Edit the scala code back.
The other solutions given here didn't work for me. I tried: clean project, restarting Eclipse, closing-&-opening the project, creating a new .scala file. No joy.
I'm using Eclipse 3.7 (latest stable), Scala IDE 2.0.0 and Scala 2.9 on Ubuntu Linux 11.10.
The symptoms in my case were:
My project was working, but then it stopped compiling for no apparent reason. The IDE didn't show any compilation errors for .scala files, but there were no .class files in the output directory & I got a NoClassDefError if I tried to run anything.
If I created a deliberate error in a .scala file, that did get picked up as a compilation error.
The .java files were registering errors due to the missing scala classes.
I suppose there's probably a boot-strapping bug somewhere in the IDE plugin for .java/.scala mixes. I've done hybrid projects with this setup without problems, so it's only triggered in some situations. I don't know what the trigger is, but once triggered, there's no nice solution.
I had moved my one and only class/object/application to a package, but had not added the package declaration.
sbt compiled and ran fine; eclipse would not
Adding the package declaration at the top of the file fixed it.
Scala 2.8.3 plugin; no compile error
I encountered this error too but after doing the suggestions here (cleaning, deleting Run Configuration etc), I realized that I set the workspace wrongly that is why the class is not being found.
An indication that this is a problem is when the same error occurs when you try to compile a java project.
I encountered this error (compilation worked in sbt but failed in eclipse) when I created a new package object called "common". Deleting the package object in eclipse caused the compile error to go away. There was nothing in it.
I was using sbt-eclipse to build the eclipse project. I'm using scala eclipse 3.0.0-vfinal-20130326-1146-Typesafe.