Friday, October 23, 2009

Releasing my code on the unsuspecting public (EclipseFP)

Today I've released a new version of EclipseFP (Haskell support in Eclipse). There are quite a few changes in it, and there are even some changes in the Scion library that I've made and that Nominolo integrated. So people can give it a try if they want: get the current Scion source code, build/install it, and get the 1.108 version of EclipseFP.
Hopefully that's another step for me in getting more proficient in Haskell: interacting with other Haskell hackers, learning from them and their code, and releasing code that may actually been of use to somebody (or annoy them no end if it doesn't work) instead of only a little game as before. And of course working on an Haskell IDE, even in Java, gets me to learn new things about the language, the options for Cabal or GHC, etc...
Anyway, I hope I'll get some feedback on the new EclipseFP, and that we can move that thing forward!

24 comments:

Neil Bartlett said...

Great! I'd love to give it a try, but the download instructions are not very clear... there seem to be multiple versions of things in different places.

Could you give us a simple list of steps to download and install this release? Thanks!

Unknown said...

I've downloaded and installed everything as indicated and it's all working great. It's nice having one IDE for both my Haskell (EclipseFP) and Scala. I had been using emacs and leksah, but i think I will now just focus on eclipse. Thanks to everyone who has worked on EclipseFP.

Rene said...

Hello, I am using windows with eclipse at c:\expanded\eclipse, workspace at c:\dev and project root at c:\dev\etest2. After adding a module Main I get the error:
"Description Resource Path Location Type
file C:\dev\etest2\src\Main.hs is not relative to project root C:\expanded\eclipse Main.hs /etest2/src line 1 Problem
"
which seems wrong to me. Anyone got any ideas?

IdentitySearch said...

Hi, I also am using Windows.

I managed to build and install Scion but I don't know how to retrieve EclipseFP version 1.108. (I apologize for my lack of knowledge). I would really like to try EclipseFP out.

Rene said...

At the very bottom of http://eclipsefp.sourceforge.net/ you will see the 0.108.0 archive. Download this and extract it to your eclipse directory in the corresponding features and plugin directories. Then use the eclipse update with option "from local" to install the above in eclipse. Update scion from the git repository as described.

IdentitySearch said...

Thanks Rene! I hadn't seen that link on the http://eclipsefp.sourceforge.net/ page. To clarify its on bottom of the Downloads page.

Thanks :D

JP Moresmau said...

Hello all, there was an issue with a file in the Eclipse update manager site, should be fixed now. Otherwise you can also download from the files section in sourceforge.

Rene, do you have more info on you issue abbout the relative path (anything in the log, any stack trace?)

Rene said...

No, unfortunately not. It was a test project created under 0.107.0.
The error appeared after upgrading to 0.108.0, though new projects seem to have this as well.
Have you tried a similar constellation yourself?

JP Moresmau said...

Well yes, since I started with 107 and slowly built 108 on top. There must be something in the Eclipse "Error Log" view, with hopefully a stack trace. Attach it to an incident on the eclipsefp sourceforge help forum, so we can track the issue better than through the blog. Even attach the zipped project directory if you want.

IdentitySearch said...

I tried to install Nominolo's scion from github. I downloaded it since I don't have an account. There are some missing libraries on hackage however such as ghc-uniplate. I downloaded that from his github once more and it then required derive 0.1.4... etc etc it's a long story but in the end I couldn't compile the latest version of scion. So I tried the version on hackage but it doesn't seem to work correctly or at least i am doing something wrong. Can you please help? Thanks I am really looking forward to using eclipseFP.

JP Moresmau said...

Rene, for some reason I had never seen your error but I realized that Scion expects to be running from the root of the project, and the eclipse code didn't enforce that. I fixed it and released it on github if you want to try it. I'm at a loss why it never caused an issue anywhere else.

Andrew, I don't recall any issue installing scion. What I would do is install the hackage version first through "cabal install scion" to get all the dependencies installed for me, then install the github version.

marcinK said...
This comment has been removed by the author.
aquarin said...

You may want to see the installation video: http://www.vimeo.com/7375105

IdentitySearch said...

Nice video Watto. Really thorough.

I just have a small question to anyone who can help. Is eclipseFP able to actually compile exes? As in:
ghc --make Main.hs -o Program.exe somehow or is that something coming later on? Thanks

PS Keep up the great work people.

Unknown said...

Hello, I installed the latest scion and eclipsefp from http://github.com/JPMoresmau/

Running Eclipse on Windows I am stuck on this problem

Parsing command: Chunk "{\"id\":37,\"method\":\"background-typecheck-file\",\"params\":{\"file\":\"C:\\\\Projects\\\\hs-prova\\\\src\\\\Main.hs\"}}" Empty
"{\"version\":\"0.1\",\"id\":37,\"result\":{\"Left\":\"Could not find file in module graph.\"}}"
p

I tried several setting in the
hs-source-dirs param in cabal file but no one seems to work.

Any hint?

JP Moresmau said...

Andrew, when the project is built (automatically or via the build project command in eclipse), exes are generated in the .dist-scion folder. In the current version of Scion the name cannot be changed so since it starts with a dot by default you don't see it in Eclipse, but it's there.

JP Moresmau said...

Pavel, you need to have hs-source-dirs: src in either a library or a executable section in your Cabal file. Show me the file and maybe I can help you.

Unknown said...

Hi, this is hs-prova.cabal

name: hs-prova
version: 0.1
hs-source-dirs: src

this is src/main.hs

module Main where
main = putStrLn "Hello, World!"

this is setup.hs

import Distribution.Simple
main = defaultMain
----------------------------

I am able to compile the single file main.hs, but not the whole project.
As soon as I open a .hs file I get this error on position 1:1 Could not find file in module graph.

There are also 2 two errors in error log and scion server output

-------------------------------
1
-------------------------------
Could not process command result
The command was:
{
"id": 5,
"method": "list-cabal-components",
"params": {"cabal-file": "C:\\JavaProjects\\hs-prova\\hs-prova.cabal"}
}
The response was:
{
"id": 5,
"result": [{"library": null}],
"version": "0.1"
}

--------------------------------
net.sf.eclipsefp.haskell.scion.exceptions.ScionCommandException: Could not process command result
The command was:
{
"id": 5,
"method": "list-cabal-components",
"params": {"cabal-file": "C:\\JavaProjects\\hs-prova\\hs-prova.cabal"}
}
The response was:
{
"id": 5,
"result": [{"library": null}],
"version": "0.1"
}

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponseResult(ScionCommand.java:285)

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponse(ScionCommand.java:273)

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.receiveResponse(ScionCommand.java:207)

at net.sf.eclipsefp.haskell.scion.internal.client.ScionServer.runCommandSync(ScionServer.java:380)

at net.sf.eclipsefp.haskell.scion.client.ScionInstance.runCommandSync(ScionInstance.java:202)

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.run(ScionCommand.java:136)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Caused by: org.json.JSONException: JSONObject["cabal-file"] not found.

at org.json.JSONObject.get(JSONObject.java:517)

at org.json.JSONObject.getString(JSONObject.java:688)

at net.sf.eclipsefp.haskell.scion.types.Component.[init]
(Component.java:41)

at net.sf.eclipsefp.haskell.scion.internal.commands.ListCabalComponentsCommand.doProcessResult(ListCabalComponentsCommand.java:28)

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponseResult(ScionCommand.java:283)

... 6 more

-----------------------------------
2)
---------------------------------

Typechecking actual file contents failed. Typechecking will only be performed on the saved document. This is normal if your Haskell code contains preprocessor instructions. The error was: The requested method is not supported.

An exception stack trace is not available.

----------------------------------
Thank you in advance, an sorry for being too verbose.

JP Moresmau said...

As indicated in http://www.haskell.org/ghc/docs/latest/html/Cabal/authors.html#buildinfo , the hs-source-dirs field must be in either an executable or library section. So your cabal file needs to be:
Name: hs-prova
Version: 0.1

library
hs-source-dirs: src

This maybe explains the error about the library component not having a cabal-file field. The other error is probably due to you using the hackage version of scion. To get the most of eclipsefp 1.108 you need to get scion from github and build it from source (http://github.com/nominolo/scion/tree/devel for example)

JP Moresmau said...

Note: in my previous comment hs-source-dirs needs to be indented, say two spaces right of library, it may not be visible in the html.

Unknown said...

Thanks JP. I modified the cabal file (with indentation in Executable section)

name: hs-prova
version: 0.1
Executable hs-prova
Main-is: Main.hs
Hs-Source-Dirs: src
Build-Depends: base

I am running latest scion (nominolo), and latest eclipsefp from http://github.com/JPMoresmau/
Official 1.108 gives me the same error of rene (Main.hs is not relative to project root), so I upgraded to latest sources

However still no working properly I think

opts: StartupConfig {connectionMode = TCPIP False 4006, autoPort = False, showHelp = False}
=== Listening on port: 4006
parsing command: Chunk "{\"id\":1,\"method\":\"connection-info\",\"params\":{}}" Empty
"{\"version\":\"0.1\",\"id\":1,\"result\":{\"version\":1,\"pid\":0}}"
parsing command: Chunk "{\"id\":2,\"method\":\"list-cabal-components\",\"params\":{\"cabal-file\":\"C:\\\\JavaProjects\\\\hs-prova\\\\hs-prova.cabal\"}}" Empty
"{\"version\":\"0.1\",\"id\":2,\"result\":[{\"executable\":\"hs-prova\"}]}"
parsing command: Chunk "{\"id\":3,\"method\":\"background-typecheck-file\",\"params\":{\"file\":\"C:\\\\JavaProjects\\\\hs-prova\\\\Setup.hs\"}}" Empty
"{\"version\":\"0.1\",\"id\":3,\"result\":{\"Left\":\"Could not find file in module graph.\"}}"

Exception Stack Trace

net.sf.eclipsefp.haskell.scion.exceptions.ScionCommandException: Could not process command result
The command was:
{
"id": 2,
"method": "list-cabal-components",
"params": {"cabal-file": "C:\\JavaProjects\\hs-prova\\hs-prova.cabal"}
}
The response was:
{
"id": 2,
"result": [{"executable": "hs-prova"}],
"version": "0.1"
}

at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponseResult(ScionCommand.java:285)
at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponse(ScionCommand.java:273)
at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.receiveResponse(ScionCommand.java:207)
at net.sf.eclipsefp.haskell.scion.internal.client.ScionServer.runCommandSync(ScionServer.java:380)
at net.sf.eclipsefp.haskell.scion.client.ScionInstance.runCommandSync(ScionInstance.java:202)
at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.run(ScionCommand.java:136)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Caused by: org.json.JSONException: JSONObject["cabal-file"] not found.

at org.json.JSONObject.get(JSONObject.java:517)
at org.json.JSONObject.getString(JSONObject.java:688)
at net.sf.eclipsefp.haskell.scion.types.Component.[init](Component.java:41)
at net.sf.eclipsefp.haskell.scion.internal.commands.ListCabalComponentsCommand.doProcessResult(ListCabalComponentsCommand.java:28)
at net.sf.eclipsefp.haskell.scion.internal.commands.ScionCommand.processResponseResult(ScionCommand.java:283)
... 6 more

JP Moresmau said...

Pavel, I think you must be using the wrong version of Scion. Either get scion from my github, or get nominolo's devel branch. In the Scion source, the Cabal.hs file ends with an instance declaration ending in :
showJSON (Library f) =
makeObject [("library", JSNull),
("cabal-file", JSString (toJSString f))]
showJSON (Executable f n) =
makeObject [("executable", JSString (toJSString n)),
("cabal-file", JSString (toJSString f))]

So components always have a cabal-file field.

Unknown said...

Thank you very much Jean-Philippe. I installed your version of scion and it worked. Previously I installed several scions, including yours, but probably there was something mixup.

Now a problem I see that it seems that GHC options set in "preferences" are not passed to the compiler. Those in cabal file istead are ok.

JP Moresmau said...

Pavel, thanks for your time. Yes, for the moment not everything is 100% consistent in EclipseFP. The GHC parameters in the preferences are not used at all. Now we're moving towards using the Cabal file for everything. Down the line, these options will probably be used for project defaults (ghc options written automatically in the Cabal file when creating a new project).