Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?
I'll be happy to give it a shot! JP On Fri, Sep 6, 2013 at 5:23 PM, Niklas Hambüchen m...@nh2.me wrote: It looks to me that technically it should be easy to split off the part required by GHC. Maybe somebody could just try that (currently it does not seem to take longer than a few hours) so that we have some basic proposal and momentum. On 07/09/13 00:04, JP Moresmau wrote: Oh, I'm happy to help as well if somebody is needed to do the change -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?
Hello all, I have an issue that has been nagging me for a while, and I'd like to make sure I haven't missed a solution to it. I'm the maintainer for the buildwrapper package. This package has dependencies on the Cabal and GHC libraries, and also uses the cabal-install executable. For example it will run cabal configure by invoking the executable, then it will load the LocalBuildInfo via the Cabal API, and extract the relevant information to start a GHC session with the proper flags, etc. Now yesterday some great news were announced, a new version of Cabal! However, I can't use it. I can of course install the Cabal library and rebuild the cabal executable but - buildwrapper will only use the version of the Cabal library that was bundled with GHC, since the GHC library has a dependency on that version of Cabal - so the library access will be using Cabal 1.16, but the executable will be 1.18 - and the library checks when reading the setup-config file that the Cabal versions match. Hence, running configure with 1.18 create build information I can't read back in 1.16. So I'm stuck. People can easily install cabal 1.18 and build their projects with it, but I can't use it in conjunction with buildwrapper. Some solutions I've considered - do not use the Cabal API and write my own code to read the local build info, and to replace all the Cabal library code I use - do not use the cabal-install executable but do everything by the API Both solutions reek of madness, and involve rewriting code that others have already written, and a maintenance nightmare with each Cabal release. So, do I have to wait a new release of GHC/Haskell Platform or is there a better solution? I suspect ghc-mod and other similar packages have the same issues. Thanks for any help! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?
Interesting: in the ghc-devs discussion, Duncan talks about a cabal-lib and a cabal-build-simple split ( http://www.haskell.org/pipermail/ghc-devs/2013-March/000821.html). That would solve my problem nicely (GHC could depend on cabal-lib only, that wouldn't have to change as often as cabal-build-simple). I don't see a trace of that split in 1.18, anybody knows if it's still on the map? And thanks everybody for the contributions, it looks I'm not the only one that had thought about that issue... JP On Fri, Sep 6, 2013 at 4:32 PM, Herbert Valerio Riedel h...@gnu.org wrote: On 2013-09-06 at 15:13:58 +0200, Yuri de Wit wrote: I spent some time looking into the touch points between ghc and cabal in the past, and the first oddity i saw was a direct dependency from ghc to the cabal sources. After taking a closer look it seems that ghc shares some common, low level modules with cabal that didnt seem to justify the whole dependency. The right solution, imho, is to review these dependencies and move the low level ones out into a separate package that is shared by both ghc and cabal and that will rarely change. The direct side effect of this is that ghc would not be tied directly to a specific cabal version and you would not have to deal with this issue. [...] fyi, a similiar/related discussion took place few months ago on ghc-devs: http://www.haskell.org/pipermail/ghc-devs/2013-March/000800.html hth, hvr -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?
Oh, I'm happy to help as well if somebody is needed to do the change, since I have much to win in the future if EclipseFP can take advantage of a new version of Cabal without having to wait for a new GHC. The split in two libraries that Duncan mentions seems the best approach to me, having InstalledPackageInfo and related classes + parsers + pretty printers available as one reasonably stable library, while having another one for the real Cabal functionality... JP On Fri, Sep 6, 2013 at 5:00 PM, Yuri de Wit yde...@gmail.com wrote: Alejandro, that is correct, as I see it. Duncan has very good points there but it seems to me that we need a concrete proposal so we can propose solutions to the problem. The fact is that the current situation is a middle of the ground that doesn't help Cabal nor Ghc. On Fri, Sep 6, 2013 at 10:54 AM, Alejandro Serrano Mena trup...@gmail.com wrote: I'm willing to help in the process, if some directions were given to me on how to tackle this problem. In any case, for me is seems fine to have a dependency from cabal to ghc, the only problem is the converse: ghc depending on cabal. Is this right? 2013/9/6 Herbert Valerio Riedel h...@gnu.org On 2013-09-06 at 15:13:58 +0200, Yuri de Wit wrote: I spent some time looking into the touch points between ghc and cabal in the past, and the first oddity i saw was a direct dependency from ghc to the cabal sources. After taking a closer look it seems that ghc shares some common, low level modules with cabal that didnt seem to justify the whole dependency. The right solution, imho, is to review these dependencies and move the low level ones out into a separate package that is shared by both ghc and cabal and that will rarely change. The direct side effect of this is that ghc would not be tied directly to a specific cabal version and you would not have to deal with this issue. [...] fyi, a similiar/related discussion took place few months ago on ghc-devs: http://www.haskell.org/pipermail/ghc-devs/2013-March/000800.html hth, hvr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0
BuildWrapper has some code that tries to link back the comments to the declaration from the AST generated by haskell-src-exts and the comments. See https://github.com/JPMoresmau/BuildWrapper/blob/master/src/Language/Haskell/BuildWrapper/Src.hs. The unit tests provide some samples: https://github.com/JPMoresmau/BuildWrapper/blob/master/test/Language/Haskell/BuildWrapper/CMDTests.hs#L572-L638. Maybe this can help you. JP On Tue, Aug 20, 2013 at 11:21 AM, Mateusz Kowalczyk fuuze...@fuuzetsu.co.uk wrote: On 20/08/13 09:48, Niklas Hambüchen wrote: Nice! I hope that haskell-suite will eventually become awesome and solve most of our automation-on-Haskell-code needs. Two questions: 1) My most desired feature would be a syntax tree that does not pluck pluck comments out and make me treat them separately. It looks much easier to me to have a fully descriptive tree and (filter . concatMap) / traverse them out in some way than getting a list of comments and having to insert them back in the right places myself. Is that possible? +1 for this. There was a small discussion relevant to this on café recently, if anyone is interested: http://comments.gmane.org/gmane.comp.lang.haskell.cafe/106768 2) Have you considered downloading the all-of-Hackage tarball and running haskell-src-exts over it to get a benchmark of how much HSE can already parse of the Haskell code out there? Thanks! -- Mateusz K. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Deriving with generics without values
Hello all, My problem is the following: I have my own data types, and I'd like to derive automatically instances of some type class from them. I've started looking at GHC.Generics, which offer tools to do exactly that. However, some functions of my typeclass do not take my data type as a parameter, but as a result. Basically: class MyClass where fromString :: String - a data MyData=MkMyData { myField ::Int } deriving (Generic) and I want to automatically generate the instance instance MyClass MyData, using default methods, etc. The GHC Generic class does say that it uses a from function that convert from the datatype to its representation: from :: a - Rephttp://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#t:Rep a xfrom :: a - Rephttp://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#t:Rep a x But I don't have a a to start from! I see from the related papers that the automatically generated code from from actually does pattern matches on constructors, so I need a value, undefined won't work. However I see the GHC.Generics also provide :+: (Sums: encode choice between constructors). If I have to provide an value, then the choice between constructor has been done! The examples about generics on http://www.haskell.org/haskellwiki/GHC.Generics do provide an example of defining the instance for :+: but I don't understand how we can get there. If I have a class method that takes a value as a parameter, and I pass undefined to it, the code will crash, since it can't pattern match on undefined. Can somebody shed some light on this? Am I using the wrong tool for the job? How can I achieve what I want? I want the full type representation with sums, but without a value to start from. Thanks a million! JP -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deriving with generics without values
Yes, this looks like a similar task, thanks a million! JP On Fri, Jul 12, 2013 at 10:57 AM, Roman Cheplyaka r...@ro-che.info wrote: Well, in your case, you need not 'from', but 'to', in order to convert from a generic representation to yours. Take a look at how a similar task is done in SmallCheck: https://github.com/feuerbach/smallcheck/blob/master/Test/SmallCheck/Series.hs#L180 https://github.com/feuerbach/smallcheck/blob/master/Test/SmallCheck/Series.hs#L352 Roman * JP Moresmau jpmores...@gmail.com [2013-07-12 10:45:39+0200] Hello all, My problem is the following: I have my own data types, and I'd like to derive automatically instances of some type class from them. I've started looking at GHC.Generics, which offer tools to do exactly that. However, some functions of my typeclass do not take my data type as a parameter, but as a result. Basically: class MyClass where fromString :: String - a data MyData=MkMyData { myField ::Int } deriving (Generic) and I want to automatically generate the instance instance MyClass MyData, using default methods, etc. The GHC Generic class does say that it uses a from function that convert from the datatype to its representation: from :: a - Rep http://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#t:Rep a xfrom :: a - Rep http://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#t:Rep a x But I don't have a a to start from! I see from the related papers that the automatically generated code from from actually does pattern matches on constructors, so I need a value, undefined won't work. However I see the GHC.Generics also provide :+: (Sums: encode choice between constructors). If I have to provide an value, then the choice between constructor has been done! The examples about generics on http://www.haskell.org/haskellwiki/GHC.Generics do provide an example of defining the instance for :+: but I don't understand how we can get there. If I have a class method that takes a value as a parameter, and I pass undefined to it, the code will crash, since it can't pattern match on undefined. Can somebody shed some light on this? Am I using the wrong tool for the job? How can I achieve what I want? I want the full type representation with sums, but without a value to start from. Thanks a million! JP -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: ig: bindings to Instagram Web Services API
Hello all, It's my pleasure to announce the initial release of ig, a library providing bindings to the Instagram Web Services API (http://instagram.com/developer/#). I'm indebted to Felipe Lessa (and all the folks at Loyful) as I've reused a lot of ideas from his code on the Facebook library. I've tried to implement much of the API, please reports on the Github repository ( https://github.com/loyful/ig) if something is missing and of course if you find issues. At https://github.com/loyful/ig-testapp you can find a yesod test application that shows authentication, real-time subscriptions and some other calls. It's very crude but can help you started. Grab it from Hackage, of course! Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem installing cabal-dev
Hello David, what I did is get cabal-dev from source (git clone git:// github.com/creswick/cabal-dev.git). This build fine, the upper bounds have been edited. Hopefully the new version will be released soon. JP On Tue, Feb 12, 2013 at 11:45 AM, David Turner d.tur...@tracsis.com wrote: Hi, From a clean install of Haskell Platform 2012.4.0.0 (on Windows) I have issued just: cabal update cabal install cabal-install cabal install cabal-dev The last command fails with: Resolving dependencies... In order, the following would be installed: tar-0.3.2.0 (new package) transformers-0.2.2.0 (new version) mtl-2.0.1.0 (new version) parsec-3.1.3 (reinstall) changes: mtl-2.1.2 - 2.0.1.0 network-2.3.2.0 (new version) HTTP-4000.2.8 (new version) cabal-dev-0.9.1 (new package) cabal: The following packages are likely to be broken by the reinstalls: network-2.3.1.0 haskell-platform-2012.4.0.0 cgi-3001.1.7.4 HTTP-4000.2.5 Use --force-reinstalls if you want to install anyway. I *think* the problem is that cabal-dev has these dependencies: mtl = 1.1 2.1, transformers = 0.2 0.3, where the latest version of mtl and transformers are 2.1.2 and 0.3 respectively. At least, if I download the latest cabal-dev package and relax those upper bounds I can get it to install. The irony is, of course, that I'm trying to install cabal-dev to get me out of a totally unrelated dependencies hole! What should I do now? Cheers, -- David Turner Senior Consultant Tracsis PLC Tracsis PLC is a company registered in England and Wales with number 5019106. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] cabal-dev add-source
Hello, I'm trying to understand cabal-dev, and I seem to be missing some basic point, because I can't get dependencies between projects working properly. I have two projects, let's call them P1 and P2. P2 depends on P1, as indicated by its cabal file build-depends field. I run cabal-dev add-source ..\P1 inside P2 then cabal-dev install Everything works fine, and my project compiles, with modules in P2 calling functions from P1. Then I add a new function if an exposed module of P1. I rerun the cabal-dev add-source and cabal-dev install commands to tell P2 of the change, as per the cabal-dev documentation. I change a file in P2 to use the new function, the compilation fails. If I check into the cabal-dev folder, I see the .hi file for my changed module has not been updated (old date). What am I missing? Thanks -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-dev add-source
That's exactly what I'm doing, and I was exactly following these notes, but it doesn't work. This google+ post and the answers to it ( https://plus.google.com/102016502921512042165/posts/TGaENqWfubP) lead me to at least one solution that seems to work: you need to unregister the changed package first. So cabal-dev ghc-pkg unregister --force P1 cabal-dev add-source ../P1 cabal-dev install Does the trick. There seems to be a way to pass a --reinstall flag to cabal-dev install but I haven't gotten it to work yet. Thanks JP On Fri, Feb 8, 2013 at 6:53 PM, Blake Rain blake.r...@gmail.com wrote: You need to call cabal-dev add-source on P1 again to copy over the sdist, then do a cabal-dev install. See notes under Using a sandbox-local Hackage on https://github.com/creswick/cabal-dev On Feb 8, 2013 2:22 PM, JP Moresmau jpmores...@gmail.com wrote: Hello, I'm trying to understand cabal-dev, and I seem to be missing some basic point, because I can't get dependencies between projects working properly. I have two projects, let's call them P1 and P2. P2 depends on P1, as indicated by its cabal file build-depends field. I run cabal-dev add-source ..\P1 inside P2 then cabal-dev install Everything works fine, and my project compiles, with modules in P2 calling functions from P1. Then I add a new function if an exposed module of P1. I rerun the cabal-dev add-source and cabal-dev install commands to tell P2 of the change, as per the cabal-dev documentation. I change a file in P2 to use the new function, the compilation fails. If I check into the cabal-dev folder, I see the .hi file for my changed module has not been updated (old date). What am I missing? Thanks -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-dev add-source
Johan, thanks, that brings me to a point that I wanted to raise. I'm playing with cabal-dev because users have asked me to add support for it in EclipseFP (so projects could have their own sandbox and have dependencies between projects without polluting the main package databases). It is worth it, or should I just wait for cabal 1.18 and use the sandboxing facility? Or will the two work similarly enough that supporting both will be easy? Does the sandboxing in cabal means that tools like cabal-dev are going to get deprecated? Thanks JP On Fri, Feb 8, 2013 at 7:02 PM, Johan Tibell johan.tib...@gmail.com wrote: On Fri, Feb 8, 2013 at 9:53 AM, Blake Rain blake.r...@gmail.com wrote: You need to call cabal-dev add-source on P1 again to copy over the sdist, then do a cabal-dev install. See notes under Using a sandbox-local Hackage on https://github.com/creswick/cabal-dehttps://github.com/creswick/cabal-dev With the new cabal sandboxing (due in 1.18) this won't be necessary as we create a link to the repo, instead of installing a copy. We will rebuild the linked repo as needed. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instead of Haskell running on the JVM is there a way for Haskell to call a JVM language ...
You may want to have a look at my little HJVM project on Github ( https://github.com/JPMoresmau/HJVM). Promise, I'll put in on Hackage some day. Basically it provides FFI wrappers and some c code to be able to start a JVM and call Java methods, etc from Haskell. -- JP Moresmau http://jpmoresmau.blogspot.com/ On Tue, Nov 20, 2012 at 7:53 AM, Mathijs Kwik math...@bluescreen303.nlwrote: KC kc1...@gmail.com writes: Instead of Haskell running on the JVM is there a way for Haskell to call a JVM language (or generate bytecode) to access the Java class libraries when needed? I once did a small test to get this working. It's not that hard, but needs some work. It's fine for exposing a few functions though. Basically it's a 2-step process, eased by using a makefile or similar helper. You have to compile your haskell code into a shared object (.so on linux, .dll on windows), which includes the haskell runtime (rts). This library can be called from c. A small pitfall is that you first need to do a call to initialize the haskell runtime, and when you're done using it, close it. This is most easily just tied to your c/java program's main initialization functions. Java is able to load/use these shared libraries through JNI. Of course you lose your platform-independance, so if you want your java application to work on multiple platforms / OSses, you need to build shared objects for all of them. Last but not least: You have to export the haskell functions you want through FFI. Also, make sure they use raw data types such as CString, as that what C and java will give you and expect back. So basically you go Haskell FFI - C - Java JNI I'm sorry I cannot give you any links or code, because I'm in a bit of a hurry. But google and the ghc docs are your friend. Mathijs Or Is there a way for a JVM language or bytecode to call Haskell when needed? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Panic loading network on windows (GHC 7.6.1)
Thanks to all, it then looks there's not much I can do. I'm trying to build scion-browser that depends on persistent, that requires TH... Thanks JP On Sat, Oct 6, 2012 at 10:26 PM, Thomas Schilling nomin...@googlemail.com wrote: Just to explain what's going on. It looks like you are compiling a module that uses template haskell, which in turn relies on GHCi bits. In particular, GHCi has a custom linker for loading compiled code. This linker is very fragile and tends to break whenever the platform GCC/linker changes. Similar issues happen a lot on OS X, because Apple tends to change their library formats on most major releases. The only workaround I can think of is to avoid using GHCi or Template Haskell, but I understand that's usually very tricky (especially if one of the dependencies uses TH). On 6 October 2012 09:57, Henk-Jan van Tuyl hjgt...@chello.nl wrote: On Fri, 05 Oct 2012 17:31:49 +0200, JP Moresmau jpmores...@gmail.com wrote: Hello, I've installed Cabal and cabal-install 1.16 (which required network) on a new GHC 7.6.1 install and everything went well, except now when building a package requiring network I get: Loading package network-2.4.0.1 ... ghc.exe: Unknown PEi386 section name `.idata $4' (while processing: c:/ghc/ghc-7.6.1/mingw/lib\libws2_32.a) ghc.exe: panic! (the 'impossible' happened) (GHC version 7.6.1 for i386-unknown-mingw32): loadArchive c:/ghc/ghc-7.6.1/mingw/lib\\libws2_32.a: failed It's a GHC bug and will be solved in GHC 7.6.2, according to: http://hackage.haskell.org/trac/ghc/ticket/7103 Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: cabal-install-1.16.0 (and Cabal-1.16.0.1)
}' to be silently ignored. * added missing error message * Don't try to run test suites where none exist. * Fixed non-exhaustive pattern matches with new InstallOutcome. * Automatically run test suites when invoked with 'cabal install --enable-tests'. Do not install if tests fail. * make test and bench available as user constraints * let --reinstall imply --force-reinstalls for targets * stanza support in modular solver * show optional stanzas when printing install plans * Added a missing case. * Enable tests and benchmarks in cabal-install without modifications to the Cabal library. * Don't build benchmarks, even if installing benchmark dependencies. * Update types in modular dependency solver to compile with new test/benchmark dependency constraints. * Handle test and benchmark dependencies through the resolver properly. * updating dependencies in bootstrap.sh * fix compilation with ghc-7.4 * Added a comment. * removing trailing whitespace * removing datatype contexts * Now require mtl-2 Complete list of changes in Cabal-1.16.0.1: * Bump Cabal version number to 1.16.0.1 * Fix failing test * Do not pass -XHaskell98 to older compilers (fixes #1016) * don't test --disable-library-vanilla for now * Fix logic for building dynamic executables with TemplateHaskell * Fix the logic for building profiled executables with TemplateHaskell. * add test for non-vanilla profiling and dynamic builds with Template Haskell * Build Setup executables without HPC. Fixes #1012. * Make 'viewAsFieldDescr' a total function. Cheers, Johan Bryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Panic loading network on windows (GHC 7.6.1)
Hello, I've installed Cabal and cabal-install 1.16 (which required network) on a new GHC 7.6.1 install and everything went well, except now when building a package requiring network I get: Loading package network-2.4.0.1 ... ghc.exe: Unknown PEi386 section name `.idata $4' (while processing: c:/ghc/ghc-7.6.1/mingw/lib\libws2_32.a) ghc.exe: panic! (the 'impossible' happened) (GHC version 7.6.1 for i386-unknown-mingw32): loadArchive c:/ghc/ghc-7.6.1/mingw/lib\\libws2_32.a: failed I have done something wrong while building network on my Windows XP machine? What can I check? Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Panic loading network on windows (GHC 7.6.1)
Well, cabal-install installed and works fine. Not sure why on my own package that I'm trying to port to GHC 7.6 it doesn't work... I'll try to investigate further. Thanks JP On Fri, Oct 5, 2012 at 6:02 PM, Johan Tibell johan.tib...@gmail.com wrote: On Fri, Oct 5, 2012 at 5:31 PM, JP Moresmau jpmores...@gmail.com wrote: Hello, I've installed Cabal and cabal-install 1.16 (which required network) on a new GHC 7.6.1 install and everything went well, except now when building a package requiring network I get: Loading package network-2.4.0.1 ... ghc.exe: Unknown PEi386 section name `.idata $4' (while processing: c:/ghc/ghc-7.6.1/mingw/lib\libws2_32.a) ghc.exe: panic! (the 'impossible' happened) (GHC version 7.6.1 for i386-unknown-mingw32): loadArchive c:/ghc/ghc-7.6.1/mingw/lib\\libws2_32.a: failed I have done something wrong while building network on my Windows XP machine? What can I check? I'm not quite sure what's going on. We did test cabal-install (and thus network) on a Windows machine before the release. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Summer of Code idea: Haskell Web Toolkit
Maybe I'll sound like an overused meme, but what about JQuery? JQuery already takes a combinator-like approach to Javascript and DOM manipulations, so maybe we could have a combinator library that would mimic the JQuery library. We'd obviously need some extra combinators for the required parts of Javascript and HTML generation that are not done via JQuery. JP On Tue, Mar 6, 2012 at 11:10 PM, Alejandro Serrano Mena trup...@gmail.com wrote: My idea would be reusing some of the already-available tools for compiling Haskell to JS (for example, UHC), and develop with any of them a complete library for client-side scripting; rather that redevelop a way to compile Haskell to JS. I think it's really a pity not being able to use things like what Yesod provides in a client-side context. And both sides would benefit: they can share common code for datatypes (as it's done in Google Web Toolkit), and autogenerate some code for sending or receiving AJAX requests, for example. 2012/3/6 Michael Snoyman mich...@snoyman.com On Tue, Mar 6, 2012 at 11:40 PM, Alejandro Serrano Mena trup...@gmail.com wrote: Hi, I'm really looking forward to helping in the Summer of Code, if Haskell goes into it this year (something I take for granted :). I would like to propose an idea for a project, and I'm looking for suggestions about whether it's good, should be improved or it's just unfeasible. My idea is to make a client-side Haskell Web Toolkit, in the spirit of Google Web Toolkit, which would allow to program in Haskell the client part of a web application, and would complement the web frameworks already existing for Haskell (such as Yesod and Snap). The point is coming about with a Haskell-ish way to program applications, to reuse all the existing knowledge for our beloved language. I've added more details in a pre-proposal in Google Docs, available in https://docs.google.com/document/d/1FnTNO9uTobDHRTDXWurKns7vGTjeauw0nRhbtt6vavs/edit Tell me if you prefer to see it in other format, but I didn't want to generate a bigger e-mail. Thanks in advance. I definitely think the idea has merit. In general I'm wary of solutions which try to compile down to Javascript[1], and I'm not sure if actually providing a full Haskell-to-JS approach is a good idea. Another possibility might be a DSL/combinator library for generating JS. Though at this point, I wouldn't rule out either approach. Yesod is currently wrapping up its 1.0 release (almost certainly out-the-door by the end of April), and after that our main focus is intended to be client-side integration, so we would certainly be happy to discuss design ideas and collaborate in general. Michael [1] I say compile down to to mean nontrivial changes, as opposed to something like Coffeescript, which is a fairly simple conversion. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Concurrency strategy for 2 threads and rare events
Thank you all, I've used a simple IORef and that did the trick. JP 2012/2/8 Edward Amsden eca7...@cs.rit.edu: If you only need one structure for communication (e.g. neither thread needs to lock multiple things) you might consider using an IORef, and writing/polling it with atomicModifyIORef. It's cheaper than an MVar for the case where you don't need to lock multiple threads. On Wed, Feb 8, 2012 at 2:45 PM, JP Moresmau jpmores...@gmail.com wrote: No, I meant they seem to be mainly for the use case where the reading thread blocks for more input, and maybe there's a simpler/more efficient way to quickly check if an event has occurred, that's all. If there isn't then a MVar it will be. JP On Wed, Feb 8, 2012 at 7:35 PM, Yves Parès yves.pa...@gmail.com wrote: Why do you think it's a lot? MVar are a teeny tiny and convenient primitive of communication, and I don't see why they wouldn't suit your need. Sure a throwTo would do the trick... But they're is do the trick and do the job, you see? Using STM and TVars *would* be kind of overkill. 2012/2/8 JP Moresmau jpmores...@gmail.com Hello, I'm wondering what's the best strategy to use in the following scenario: - 2 threads - One perform some work that will take time, possibly go on forever - Another waits for user input (like commands from the keyboard) that affects thread 1 (causing it to stop, in the simplest case) I've read a bit on MVar and channels, but they seem to be a lot for cases where the reading thread block for input. In my case, I expect to have something that thread 2 updates when an event occur, and thread 1 checks it regularly. So thread 1 should not block, but should check is there something and there is, act on it, otherwise continue doing what it was currently doing. I suppose I could just tryTakeMVar on a MVar, but is there something more adapted to my needs? Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Edward Amsden Student Computer Science Rochester Institute of Technology www.edwardamsden.com -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC -WAll, -fwarn-unused-do-bind and Cabal
Yes, I would have suspected that the doc was wrong, and indeed the latest version on GHC 7.4 does not mention that flag as being excluded, but the fact is that through the GHC API, I don't get that warning! I can get other warnings so I would say that the way I use the API is correct.In the GHC 7.0 API are there several ways to get warnings, or are some warnings only raised at the final generation stage (which I don't do with the API)? That would be the most sensible explanation: that warning is only raised during code generation but not during loading and typechecking of the module. Can somebody privy with GHC internals confirm? It's just that I've noticed the problem in my EclipseFP/buildwrapper setup and I want to make sure the issue can be explained if users run into it. Thanks anyway for looking into it! JP On Wed, Feb 15, 2012 at 8:33 PM, Albert Y. C. Lai tre...@vex.net wrote: On 12-02-14 03:01 PM, JP Moresmau wrote: I'm confused: I'm using GHC 7.0.2 and Cabal 1.10.1.0 with cabal-install 0.10.2. I use -Wall in my Cabal file. If I build a Haskell file with unused do binds, via the GHC API I get no warning, which is normal, since the doc states: The warnings that are not enabled by -Wall are ..., -fwarn-unused-do-bind But if I build my project through cabal it gives me the warning! Why is compiling with Cabal giving that extra warning that GHC on its own with the same flags doesn't give? Using --verbose on cabal build does not give any clue, no suspicious extra flag is passed on. The plot thickens as I perform some experiments. Experiment #1: main :: IO () main = do { x - getLine; putStrLn thank you } ghc -Wall = Warning: Defined but not used: `x' ghc -fwarn-unused-do-bind = (no warning) Apparently, warn-unused-do-bind does not mean that x is unused. Experiment #2: main :: IO () main = do { getLine; putStrLn thank you } ghc -fwarn-unused-do-bind = Warning: A do-notation statement discarded a result of type String. Suppress this warning by saying _ - getLine, or by using the flag -fno-warn-unused-do-bind ghc -Wall = Warning: A do-notation statement discarded a result of type String. Suppress this warning by saying _ - getLine, or by using the flag -fno-warn-unused-do-bind ghc -Wall -fno-warn-unused-do-bind = (no warning) Apparently, -Wall turns on -fwarn-unused-do-bind, despite the user guide. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-Cafe Tag (was: Optimizations and parallel execution in the IO for a small spellchecker)
I was not aware that it was something a poster was supposed to do, but now I notice that while the messages I get from the list have [Haskell-Cafe] on their subject, the ones I post don't. The Haskell-Cafe info page (http://www.haskell.org/mailman/listinfo/haskell-cafe) does not mention that you should have that tag in the subject. I'm probably a uncouth Frenchman knowing nothing about netiquette, but surely the list software could add such a tag if it was required? JP On Wed, Feb 15, 2012 at 8:14 PM, Paul Sujkov psuj...@gmail.com wrote: Sorry, I've forgotten to add a [Haskell-Cafe] tag for the message. On 15 February 2012 19:33, Paul Sujkov psuj...@gmail.com wrote: Hi everyone, http://hpaste.org/63732 that's a very simple spellchecker application: it consumes standard Linux dictionary, reads a file, and prints out words from that file that are not on the dictionary. I have taken it from a little cross-language benchmark and used to benchmark existing hash table implementations available on Hackage (with one used in code being the best according to timings). The question is: can I go further and effectively execute lookup and (maybe) output (line 20 or line 26 in the snippet) in parallel? I'm not good at all with Haskell parallel packages; I've tried monad-parallel (naive implementation eats away all the memory available) and parallel (haven't tried Par monad yet), but the last dosn't seem to fit well with the IO operations. If anyone can give me any suggestions on how can I implement parallel execution, or any thoughts on further sequential optimizations, it would be deeply appreciated. -- Regards, Paul Sujkov -- Regards, Paul Sujkov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-Cafe Tag (was: Optimizations and parallel execution in the IO for a small spellchecker)
OK, thanks all, I can stop worrying being an uncouth Frenchman, then... JP On Wed, Feb 15, 2012 at 9:01 PM, Brandon Allbery allber...@gmail.com wrote: On Wed, Feb 15, 2012 at 14:49, JP Moresmau jpmores...@gmail.com wrote: I was not aware that it was something a poster was supposed to do, but now I notice that while the messages I get from the list have [Haskell-Cafe] on their subject, the ones I post don't. The list software adds it. You don't see it because the copy from the list has the same message id as the copy gmail saves when you send it, so gmail tosses the list copy from your mailstore as a duplicate. Don't worry about it. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC -WAll, -fwarn-unused-do-bind and Cabal
I'm confused: I'm using GHC 7.0.2 and Cabal 1.10.1.0 with cabal-install 0.10.2. I use -Wall in my Cabal file. If I build a Haskell file with unused do binds, via the GHC API I get no warning, which is normal, since the doc states: The warnings that are not enabled by -Wall are ..., -fwarn-unused-do-bind But if I build my project through cabal it gives me the warning! Why is compiling with Cabal giving that extra warning that GHC on its own with the same flags doesn't give? Using --verbose on cabal build does not give any clue, no suspicious extra flag is passed on. Any pointer appreciated! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Concurrency strategy for 2 threads and rare events
Hello, I'm wondering what's the best strategy to use in the following scenario: - 2 threads - One perform some work that will take time, possibly go on forever - Another waits for user input (like commands from the keyboard) that affects thread 1 (causing it to stop, in the simplest case) I've read a bit on MVar and channels, but they seem to be a lot for cases where the reading thread block for input. In my case, I expect to have something that thread 2 updates when an event occur, and thread 1 checks it regularly. So thread 1 should not block, but should check is there something and there is, act on it, otherwise continue doing what it was currently doing. I suppose I could just tryTakeMVar on a MVar, but is there something more adapted to my needs? Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Concurrency strategy for 2 threads and rare events
No, I meant they seem to be mainly for the use case where the reading thread blocks for more input, and maybe there's a simpler/more efficient way to quickly check if an event has occurred, that's all. If there isn't then a MVar it will be. JP On Wed, Feb 8, 2012 at 7:35 PM, Yves Parès yves.pa...@gmail.com wrote: Why do you think it's a lot? MVar are a teeny tiny and convenient primitive of communication, and I don't see why they wouldn't suit your need. Sure a throwTo would do the trick... But they're is do the trick and do the job, you see? Using STM and TVars *would* be kind of overkill. 2012/2/8 JP Moresmau jpmores...@gmail.com Hello, I'm wondering what's the best strategy to use in the following scenario: - 2 threads - One perform some work that will take time, possibly go on forever - Another waits for user input (like commands from the keyboard) that affects thread 1 (causing it to stop, in the simplest case) I've read a bit on MVar and channels, but they seem to be a lot for cases where the reading thread block for input. In my case, I expect to have something that thread 2 updates when an event occur, and thread 1 checks it regularly. So thread 1 should not block, but should check is there something and there is, act on it, otherwise continue doing what it was currently doing. I suppose I could just tryTakeMVar on a MVar, but is there something more adapted to my needs? Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-api Static Semantics?
As a side note, buildwrapper version 0.4.0 and above follows the approach you outline. When a file is modified, we call GHC to build it, and we store the GHC AST as a JSON object in a hidden file. Then all subsequent calls that make use of the JSON data (in EclipseFP, this would be to show you a tooltip of the type of the object you're hovering over) without calling GHC again, so it's much faster, even though buildwrapper is a pure one shot executable with no concept of a session. The JSON file could also be read by another process that buildwrapper itself, so maybe Christopher could use this approach. JP On Thu, Jan 26, 2012 at 7:00 PM, Thomas Schilling nomin...@googlemail.com wrote: On 26 January 2012 16:33, JP Moresmau jpmores...@gmail.com wrote: Thomas, thank you for that explanation about the different type of identifiers in the different phases of analysis. I've never seen that information so clearly laid out before, can it be added to the wikis (in http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/API or http://www.haskell.org/haskellwiki/GHC/As_a_library maybe)? I think it would be helpful to all people that want to dive into the GHC API. Will do. On a side note, I'm going to do something very similar in my BuildWrapper project (which is now the backend of the EclipseFP IDE plugins): instead of going back to the API every time the user requests to know the type of something in the AST, I'm thinking of sending the whole typed AST to the Java code. Maybe that's something Christopher could use. Both the BuildWrapper code and Thomas's scion code are available on GitHub, as they provide examples on how to use the GHC API. I really don't think you want to do much work on the front-end as that will just need to be duplicated for each front-end. That was the whole point of building Scion in the first place. I understand, of course, that Scion is not useful enough at this time. Well, I currently don't have much time to work on Scion, but the plan is as follows: - Scion becomes a multi-process architecture. It has to be since it's not safe to run multiple GHC sessions inside the same process. Even if that were possible, you wouldn't be able to, say, have a profiling compiler and a release compiler in the same process due to how static flags work. Separate processes have the additional advantage that you can kill them if they use too much memory (e.g., because you can't unload loaded interfaces). - Scion will be based on Shake and GHC will mostly be used in one-shot mode (i.e., not --make). This makes it easier to handle preprocessed files. It also allows us to generate and update meta-information on demand. I.e., instead of parsing and typechecking a file and then caching the result for the current file, Scion will simply generate meta information whenever it (re-)compiles a source file and writes that meta information to a file. Querying or caching that meta information then is completely orthogonal to generating it. The most basic meta information would be a type-annotated version of the compiled AST (possibly + warnings and errors from the last time it was compiled). Any other meta information can then be generated from that. - The GHCi debugger probably needs to be treated specially. There also should be automatic detection of files that aren't supported by the bytecode compiler (e.g., those using UnboxedTuples) and force compilation to machine code for those. - The front-end protocol should be specified somewhere. I'm thinking about using protobuf specifications and then use ways to generate custom formats from that (e.g., JSON, Lisp S-Expressions, XML?). And if the frontend supports protocol buffers, then it can use that and be fast. That also means that all serialisation code can be auto-generated. I won't have time to work on this before the ICFP deadline (and only very little afterwards), but Scion is not dead (just hibernating). JP On Thu, Jan 26, 2012 at 2:31 PM, Thomas Schilling nomin...@googlemail.com wrote: On 26 January 2012 09:24, Christopher Brown cm...@st-andrews.ac.uk wrote: Hi Thomas, By static semantics I mean use and bind locations for every name in the AST. Right, that's what the renamer does in GHC. The GHC AST is parameterised over the type of identifiers used. The three different identifier types are: RdrName: is the name as it occurred in source code. This is the output of the parser. Name: is basically RdrName + unique ID, so you can distinguish two xs bound at different locations (this is what you want). This is the output of the renamer. Id: is Name + Type information and consequently is the output of the type checker. Diagram: String --parser-- HsModule RdrName --renamer-- HsModule Name --type-checker-- HsBinds Id Since you can't hook in-between renamer and type checker, it's perhaps more
Re: [Haskell-cafe] zlib 0.5.3.2 broken?
I had an issue as well and the explanation is on StackOverflow, so I suppose it is a known issue: http://stackoverflow.com/questions/8961413/zlib-build-error-with-ghc Putting a double # in front of the offending preprocessor directives fixed it for me. JP On Thu, Feb 2, 2012 at 6:59 AM, Michael Snoyman mich...@snoyman.com wrote: Hi all, I've received a number of reports of a broken zlib 0.5.3.2 (and experienced it myself). Is this a generally known issue? As a temporary workaround, I've released a new version of zlib-bindings that has an upper bound on zlib to avoid 0.5.3.2 (and later). Once a new patched version is released, I'll release an updated version of zlib-bindings to remove that overly restrictive upper bound. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-api Static Semantics?
Thomas, thank you for that explanation about the different type of identifiers in the different phases of analysis. I've never seen that information so clearly laid out before, can it be added to the wikis (in http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/API or http://www.haskell.org/haskellwiki/GHC/As_a_library maybe)? I think it would be helpful to all people that want to dive into the GHC API. On a side note, I'm going to do something very similar in my BuildWrapper project (which is now the backend of the EclipseFP IDE plugins): instead of going back to the API every time the user requests to know the type of something in the AST, I'm thinking of sending the whole typed AST to the Java code. Maybe that's something Christopher could use. Both the BuildWrapper code and Thomas's scion code are available on GitHub, as they provide examples on how to use the GHC API. JP On Thu, Jan 26, 2012 at 2:31 PM, Thomas Schilling nomin...@googlemail.com wrote: On 26 January 2012 09:24, Christopher Brown cm...@st-andrews.ac.uk wrote: Hi Thomas, By static semantics I mean use and bind locations for every name in the AST. Right, that's what the renamer does in GHC. The GHC AST is parameterised over the type of identifiers used. The three different identifier types are: RdrName: is the name as it occurred in source code. This is the output of the parser. Name: is basically RdrName + unique ID, so you can distinguish two xs bound at different locations (this is what you want). This is the output of the renamer. Id: is Name + Type information and consequently is the output of the type checker. Diagram: String --parser-- HsModule RdrName --renamer-- HsModule Name --type-checker-- HsBinds Id Since you can't hook in-between renamer and type checker, it's perhaps more accurately depicted as: String --parser-- HsModule RdrName --renamer+type-checker-- (HsModule Name, HsBinds Id) The main reasons why it's tricky to use the GHC API are: You need to setup the environment of packages etc. E.g., the renamer needs to look up imported modules to correctly resolve imported names (or give a error). The second is that the current API is not designed for external use. As I mentioned, you cannot run renamer and typechecker independently, there are dozens of invariants, there are environments being updated by the various phases, etc. For example, if you want to generate code it's probably best to either generate HsModure RdrName or perhaps the Template Haskell API (never tried that path). / Thomas -- Push the envelope. Watch it bend. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc-api Static Semantics?
On Tue, Jan 24, 2012 at 11:04 AM, Christopher Brown cm...@st-andrews.ac.uk wrote: At the moment (and spending half a day yesterday just working out how to 'show' an AST from the ghc-api) I'm veering towards haskell-src-exts. I think extending it to contain use and bind locations in the AST would be the best option for me. There's also a question of having types in the AST as well. Have you looked at ghc-syb-utils, which gives a neat way to print an AST? http://hackage.haskell.org/packages/archive/ghc-syb-utils/0.2.1.0/doc/html/GHC-SYB-Utils.html -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Typechecking Using GHC API
My own buildwrapper package (available from github and hackage) uses both haskell-src-exts and the GHC API to provide the same kind of services to the EclipseFP IDE plugins. You may be able to use it directly for your purpose or at least have a look at the code to get a feel for how to use the GHC API. Hope this helps JP On Thu, Dec 15, 2011 at 11:07 AM, Niklas Broberg niklas.brob...@gmail.com wrote: Currently: Your only option is to use GHC API if you want type checking. I can't help you with that, sorry. Envisioned: The function you ask for can definitely be written for haskell-src-exts, which I know you are currently using. I just need to complete my type checker for haskell-src-exts first. Which is not a small task, but one that has been started. I doubt it will be done in time for your project though, sorry. Best regards, /Niklas On Tue, Dec 13, 2011 at 6:16 PM, Sh NJP shayan@gmail.com wrote: Hi, I do some pre-processing on a normal Haskell code ( -F ). The pre-processor needs to know the type of each expression. What are the possibilities to do so? Can I use GHC API to employ GHC type checker? If yes, any good tutorial? Is it too naive to think of a function, f :: String - AnnotatedAST , that takes Haskell code and returns its corresponding abstract syntax tree annotated with types? Thanks, /shayan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] hackage and cabal test support: why does it claim I have no type field when I do?
Maybe the issue is that the test modules are missing from the distribution file, which is a known bug. (http://hackage.haskell.org/trac/hackage/ticket/792) JP On Sat, Oct 22, 2011 at 7:04 PM, Doug Burke doug_j_bu...@yahoo.com wrote: I've just been updating my code to take advantage of the test support in Cabal. I have it so that cabal configure --enable-tests cabal build cabal test works. However, when I try to upload to hackage, I get cabal upload -c dist/swish-0.6.2.0.tar.gz Checking dist/swish-0.6.2.0.tar.gz... Error: dist/swish-0.6.2.0.tar.gz: 400 Error in upload 400 Error in upload line 271: The 'type' field is required for test suites. The available test types are: exitcode-stdio-1.0 and here are the relevant lines from the cabal file: 267 if flag(developer) 268 ghc-options: -Werror 269 ghc-prof-options: -auto-all 270 271 Test-Suite test-builtinmap 272 type: exitcode-stdio-1.0 273 Hs-Source-Dirs: tests/ src/ 274 Main-Is: BuiltInMapTest.hs 275 Other-Modules: TestHelpers 276 As you can see, there's a type field for the Test-Suite and I don't see any obvious discrepancy with the information from the user's guide (http://www.haskell.org/cabal/users-guide/#test-suites). I also have Cabal-Version: = 1.9.2 in the file; the full version can be found at https://bitbucket.org/doug_burke/swish/src/4545220d88e2/swish.cabal#cl-271 What am I doing wrong? Thanks in advance, Doug ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: GHC as a library error.
The release notes say: The type of defaultErrorHandler has changed. In particular, this means that you will normally want to pass it defaultLogAction instead of defaultDynFlags. (http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/release-7-2-1.html). defaultLogAction is in the DynFlags module, reexported by GHC. I haven't tried it yet, though. Unfortunately the documentation about using GHC as an API is often not up to date. Even the API documentation is wrong: for example, the documentation for the load function talks about a reportModuleCompilationResult callback that doesn't exist any more, and the release notes do not explain the changes to the load function (loadWithLogger gone, etc). You can look at the projects using the GHC API for inspiration, for example the Scion library. JP On Tue, Oct 18, 2011 at 12:34 AM, Paulo Pocinho poci...@gmail.com wrote: Forwarding to Haskell-Cafe: I'm trying GHC as a library, as documented in: http://www.haskell.org/haskellwiki/GHC/As_a_library http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/ghc-as-a-library.html However, this code: import GHC import GHC.Paths ( libdir ) import DynFlags ( defaultDynFlags ) main = defaultErrorHandler defaultDynFlags $ do runGhc (Just libdir) $ do dflags - getSessionDynFlags setSessionDynFlags dflags target - guessTarget test_main.hs Nothing setTargets [target] load LoadAllTargets Produces: Couldn't match expected type `Severity' with actual type `DynFlags.Settings' Expected type: DynFlags.LogAction Actual type: DynFlags.Settings - DynFlags In the first argument of `defaultErrorHandler', namely `defaultDynFlags' In the expression: defaultErrorHandler defaultDynFlags How can I fix it? Note: this was on a fresh install with latest stable GHC installer 7.2.1. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] __GLASGOW_HASKELL__ macro in 7.2.1
Hello list, I must be doing something stupid, but what? ghc --version The Glorious Glasgow Haskell Compilation System, version 7.2.1 ghc -E -optP-dM -cpp Main.hs (per http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html) {-# LINE 1 Main.hs #-} #define mingw32_HOST_OS 1 #define i386_BUILD_ARCH 1 #define __GLASGOW_HASKELL__ 702 #define __STDC_HOSTED__ 1 #define i386_HOST_ARCH 1 #define mingw32_BUILD_OS 1 I'm on Windows so everything else is correct except the line that tells me I'm using 7.0.2. Unfortunately I have code that works under 7.0.3 and breaks under 7.2.1 (and the 7.2.1 code breaks under 7.0.3, of course) so I don't see anything other option than conditional compilation. What am I doing wrong? Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] __GLASGOW_HASKELL__ macro in 7.2.1
Thank you both, I misread that page on the versions and didn't see the difference between minor version number and release number. So I can confirm, my 7.0.3 install gives me 700 and my 7.2.1 gives me 702. Everything is good. Thanks! JP On Fri, Oct 14, 2011 at 5:13 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Friday 14 October 2011, 16:47:45, JP Moresmau wrote: Hello list, I must be doing something stupid, but what? ghc --version The Glorious Glasgow Haskell Compilation System, version 7.2.1 ghc -E -optP-dM -cpp Main.hs (per http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.h tml) {-# LINE 1 Main.hs #-} #define mingw32_HOST_OS 1 #define i386_BUILD_ARCH 1 #define __GLASGOW_HASKELL__ 702 #define __STDC_HOSTED__ 1 #define i386_HOST_ARCH 1 #define mingw32_BUILD_OS 1 I'm on Windows so everything else is correct except the line that tells me I'm using 7.0.2. No, __GLASGOW_HASKELL__ == 702 means you're using ghc-7.2.*, not 7.0.2. The second and third digit of the version are for the second component, so 610 was 6.10.*, 612 was 6.12.* Unfortunately I have code that works under 7.0.3 and breaks under 7.2.1 (and the 7.2.1 code breaks under 7.0.3, of course) so I don't see anything other option than conditional compilation. #in __GLASGOW_HASKELL__ = 702 -- code for 7.2.1 and greater #else -- code for ghc = 7.0.4 #endif -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] SSH in community.haskell.org
You need to launch the Pageant utility that comes with Putty, and load your key in it. Then start your putty session, putty will then use your key, and you'll be able to connect. Once started, Pageant runs in the system tray. Hope this helps. JP On Thu, Oct 13, 2011 at 10:40 AM, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: Hi Cafe! This is not actually a question about Haskell, but it is related. I sent my request and I have now an account in community.haskell.org. When I was going to use my project, I read these instructions: http://community.haskell.org/admin/using_project.html But I stopped in the first step If you need to use a shell, SSH to community.haskell.org. OK, I don't have too knowledge in SSH, so I searched the web and found putty as an SSH client. I downloaded it and tried it. But, sadly, without success. I put this configuration: Host name: community.haskell.org Port: 22 Connection type: SSH And it connects! Then, server asks me for an user name, and, after I put my user name, it throws the following error: Disconnected: No supported authentication methods available (server sent: publickey). Uh... I have no idea of how to avoid this error. Wrong client? Wrong configuration? Well, I have a public key I didn't put anywhere yet (but in the community registration). I guess I'm lacking some authentication, but I don't know how to solve it. I hope someone can give me some pointers! Thanks in advance! And sorry if this is not a strictly-related Haskell question. Daniel Díaz. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The best way to call Java from Haskell?
I had started a project to start a JVM and call Java code from Haskell, but got sidetracked into EclipseFP, but I hope to go back to it someday. https://github.com/JPMoresmau/HJVM. Have a look at the test suite for some examples. Hope this helps JP On Tue, Oct 11, 2011 at 7:20 AM, Aatch blad...@gmail.com wrote: There are some projects to try and provide a bridge between Haskell and the JVM. Unfortunately none of the seem to have much development. As it stands, there is GCJNI, which allows Haskell to invoke Java code, seems like a Java version of hsc2hs, but the site is down, it just 404s. There is also haskell-jvm-bridge, but that doesn't look like it has any development for about 18 months, and there isn't much about it. Then there is LambdaVM, which looks the most promising, as it compiles GHC byte-code to JVM bytecode. However, it doesn't look it has been updated in a few years. You can try your luck with any of those, but currently, if you want a decent FFI for Java, you're probably going to have to resurrect one of those projects. --- James Miller On 11 October 2011 15:26, Claude Lee calee2...@gmail.com wrote: Hi, vote+1. Theoretically, you can bridge Haskell and Java with FFI. It applys to small projects. Larger ones may need some build tools... Claude 2011/10/11 dokondr doko...@gmail.com Hi, I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does not have a similar one): http://nlp.stanford.edu/software/lex-parser.shtml What would be the most reliable framework for this? Thanks! Dmitri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The best way to call Java from Haskell?
Maybe your Haskell code could be compiled with only minor modifications on something like CAL or Frege? There seems to be some interest in them these days, so maybe a translator is on its way... JP On Tue, Oct 11, 2011 at 8:23 AM, Michael Snoyman mich...@snoyman.com wrote: Perhaps my needs are unique here, but I thought I'd mention them anyway. The main tool we use at work is based on a hodge-podge of Java, Ant and XSLT code[1]. This thing has to be constantly extended to support new functionality (or fix one of its myriad bugs), and there's no technical hurdle to using Haskell to that end. In fact, my company has released a few packages[2][3][4] specifically in this venture. There are two problems, however: * Some clients have an insistence that code run on the JVM. * It's inconvenient having multiple executables. Additionally, I've run into some problems in the past deploying to ancient Linux servers[5]. So for my use case, I don't care at all about interacting with Java code, I simply want to be able to turn my existing Haskell code into a JAR file. This seems like a much simpler undertaking, but I'm still not aware of any way to get this to happen right now either. Michael [1] http://dita-ot.sourceforge.net/ [2] http://hackage.haskell.org/package/xml-enumerator [3] http://hackage.haskell.org/package/xml-hamlet [4] http://hackage.haskell.org/package/uri-enumerator [5] http://stackoverflow.com/questions/5953199/create-a-static-haskell-linux-executable On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau jpmores...@gmail.com wrote: I had started a project to start a JVM and call Java code from Haskell, but got sidetracked into EclipseFP, but I hope to go back to it someday. https://github.com/JPMoresmau/HJVM. Have a look at the test suite for some examples. Hope this helps JP On Tue, Oct 11, 2011 at 7:20 AM, Aatch blad...@gmail.com wrote: There are some projects to try and provide a bridge between Haskell and the JVM. Unfortunately none of the seem to have much development. As it stands, there is GCJNI, which allows Haskell to invoke Java code, seems like a Java version of hsc2hs, but the site is down, it just 404s. There is also haskell-jvm-bridge, but that doesn't look like it has any development for about 18 months, and there isn't much about it. Then there is LambdaVM, which looks the most promising, as it compiles GHC byte-code to JVM bytecode. However, it doesn't look it has been updated in a few years. You can try your luck with any of those, but currently, if you want a decent FFI for Java, you're probably going to have to resurrect one of those projects. --- James Miller On 11 October 2011 15:26, Claude Lee calee2...@gmail.com wrote: Hi, vote+1. Theoretically, you can bridge Haskell and Java with FFI. It applys to small projects. Larger ones may need some build tools... Claude 2011/10/11 dokondr doko...@gmail.com Hi, I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does not have a similar one): http://nlp.stanford.edu/software/lex-parser.shtml What would be the most reliable framework for this? Thanks! Dmitri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: EclipseFP 2.1.0 released
Hello Haskellers, Version 2.1.0 of the EclipseFP project (Eclipse plugins for Haskell development) has been released. Based mainly on the work Alejandro Serrano did for his GSoC project, this release features a lot of enhancements: - A package/module browser - Hoogle integration: select a identifier in your code and jump to its hoogle definitions - HLint integration: jump directly to HLint errors and warnings - Profiling graphs: run an executable with profiling flags and its the resulting graphs - SourceGraph: generate SourceGraph reports - Better auto completion information And of course some bug fixes. Please go to http://eclipsefp.github.com/, the new website Alejandro designed for more information and installation instructions. Feedback welcome! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Generics (SYB) with parametrized types
Hello, I'm banging my head against a wall there trying to use the syb generics schemes against the GHC API. I'm looking at implementing a search mechanism in the AST in the more direct way that what Scion does (creating an instance of a TypeClass for each AST node type). Since the GHC AST types derive from Data and Typeable, I thought it would be possible. So the problem is a follows: I have a start type, say TypecheckedSource, that derives from Data. What I'd like to do is to find all instances of the Located type inside that source that span a particular range. The problem is that Located is a parametrized type that wraps anything and just add location information. So the result of the search could be anything. Ideally, I'd like to restrict my search to Located instances that wrap an instance of Outputable, pretty print that and output only the result. So I'm looking to implement something that would have that signature: TypecheckedSource - (Line,Column) - [String] I have written code along these lines: everything (++) ([] `mkQ` overlap) ts where overlap :: forall b1 . (Outputable b1, Typeable b1) =Located b1 - [String] overlap (a::Located b1)= ... trivial code here finding if the location overlaps, and if it does, pretty print the object, otherwise returns [] And GHC complains: Ambiguous type variable `b10' in the constraints: (Outputable b10) arising from a use of `overlap' at ... (Typeable b10) arising from a use of `overlap' at ... So it doesn't like the fact that I don't know which types my Located instances wrap. But that's the point, I don't care, I just want to restrict my search to the ones I can pretty print. If I just try the code against simple non parametrized types it of course works. If I add some forall b1 . (Outputable ... in my main function signature it complains that I never use b1 anywhere else in the signature, of course. Is there a way to achieve what I want (-XOhPleaseDoWhatIwantEvenIfIamNotSureItMakesSense or something)? Thanks a million! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Server hosting
I use Amazon EC2 Free Tier. You can install Yesod/Warp easily enough and it's fine for small traffic. JP On Fri, May 6, 2011 at 8:07 PM, Andrew Coppin andrewcop...@btinternet.com wrote: OK, so strictly this is unrelated to Haskell as such. However, there's enough people doing webby stuff with Haskell that some of you must have wanted to run your code on a real, Internet-accessible web server. So does anybody have any suggestions on which companies offer the most favourable tools / pricing? I currently have a website, but it supports only CGI *scripts* (i.e., Perl or PHP). It does not support arbitrary CGI *binaries*, which is what I'd want for Haskell. In fact, I don't have control over the web server at all; I just put content on there. The same provider can offer me a virtual server, but at 3x the price I'm currently paying. I simply cannot afford that kind of money just for silly toy projects. What does everybody else use? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] RFC: Extendable and Easy-To-Use Logger (HLogger)
Jon, thanks for HLogger! For my (small) needs I was looking for a simple logging solution, and I couldn't get HSLogger to do what I wanted, whereas your simpleLogger fitted the bill perfectly. I suppose a good thing would be conditional buffering, as other noted: in development mode I want to get my log entries flushed to disk immediately, while in production I don't want to impact the performance of my running application by waiting for the logs. I didn't think that the invocations needed to be made easier: I just used logNotice logger message, hard to do shorter. JP On Tue, Apr 12, 2011 at 11:45 PM, Henk-Jan van Tuyl hjgt...@chello.nl wrote: On Tue, 12 Apr 2011 19:10:09 +0200, Gregory Collins g...@gregorycollins.net wrote: On Tue, Apr 12, 2011 at 6:40 PM, Jon Kristensen technol...@jonkristensen.com wrote: Hello Haskellers! As I have now implemented everything that I could think of, I would like to ask the Haskell community to give some feedback on HLogger so that I can continuing improving it. Some questions: Do you have any general/architectural thoughts on things I might be doing wrong? 1) Use Text as the string type, not String 2) Re: SimpleLogger: writing to and flushing the log file upon receiving each message is absolutely the wrong thing to do in high-performance code. Each write() is a context switch into the kernel, and doing it this way will kill your throughput (in messages per second). What we do in our webserver (which relies on high-throughput access logging) is to buffer messages to the log channel in memory, and perform the actual writes in a separate worker thread no more often than once every N seconds. If you want to know what the last thing was that your application was doing, before it crashed (e.g. at the customers site), you better write every message immediately to disk. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= search i The last line fails. I don't understand why this doesn't compile. Thanks, JP On Fri, Mar 18, 2011 at 12:56 PM, Dimitrios Vytiniotis dimit...@microsoft.com wrote: Hi, can you elaborate a bit? What is Id and what is (Sig id) and IdSig in your example? Can you reproduce an example that you believe should compile but doesn't? thanks d- -Original Message- From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of JP Moresmau Sent: 16 March 2011 21:46 To: Haskell Cafe Subject: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7 Hello, when moving to GHC7 a body of code that I'm not immensely familiar with, I got an error compiling with GHC 7.0.2. Can somebody kindly explain to me what it means and how to get around it? This is in the scion code base so is using some GHC types. I have a class with a functional dependency (I think :-p): class Search id a | a - id where search :: (SrcSpan - Bool) - SrcSpan - a - SearchResults id And some instances, notably: instance Search Id Id where search _ _ i = only (FoundId i) And the error occurs on another instance: instance (Search id id) = Search id (Sig id) where search p s (IdSig i) = search p s i ... other cases here, that work The error is: Could not deduce (id ~ Id) from the context (Search id id) bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:10-45 `id' is a rigid type variable bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:18 When using functional dependencies to combine Search Id Id, arising from the dependency `a - id' in the instance declaration at lib\Scion\Inspect\Find.hs:183:10 Search id Id, arising from a use of `search' at lib\Scion\Inspect\Find.hs:479:32-37 In the expression: search p s i In an equation for `search': search p s (IdSig i) = search p s i If I replace the call to search with the actual implementation of search for Id, it compiles, so at some level the code makes sense. I much prefer when error messages end with Possible fix:...! Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Thanks to you all, I think I understand better. instance Search Id Id where search _ _ i = only (FoundId i) Is too restrictive on the first type, so declaring instead: instance Search id Id where search _ _ i = only (FoundId i) Fixed the issue!! Now the initial id is not Id and everybody is happy (and the code still seems to work as intended) thanks again JP On Fri, Mar 18, 2011 at 2:17 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Friday 18 March 2011 13:35:22, JP Moresmau wrote: These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i) = search i The last line fails. I don't understand why this doesn't compile. In (IdSig i), i has type Id, hence search i :: Result Id but you want something of type `Result id'. Fortunately it's easy to transform, since search i is a ResultId, so instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i) = case search i of ResultId y - ResultId y _ - error foo compiles (and probably does what you want). -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal test interface, what/where is it?
Hello, the following URL contains some useful information: http://www.haskell.org/cabal/release/cabal-1.10.1.0/doc/users-guide/#test-suites Hope this helps, JP On Fri, Mar 18, 2011 at 8:37 PM, Magnus Therning mag...@therning.org wrote: After upgrading to ghc7 and Cabal 1.10 I get the following message when running 'Setup configure' on one of my packages: Setup.hs:3:1: Warning: In the use of `runTests' (imported from Distribution.Simple, but defined in Distribution.Simple.UserHooks): Deprecated: Please use the new testing interface instead! I usually turn to the Cabal docs at [1], but the new testing interface isn't mentioned. Looking through the haddock API reference doesn't offer any obvious pointers. So, where should I turn to get rid of the warning? /M [1] http://www.haskell.org/ghc/docs/latest/html/Cabal/ -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
Hello, when moving to GHC7 a body of code that I'm not immensely familiar with, I got an error compiling with GHC 7.0.2. Can somebody kindly explain to me what it means and how to get around it? This is in the scion code base so is using some GHC types. I have a class with a functional dependency (I think :-p): class Search id a | a - id where search :: (SrcSpan - Bool) - SrcSpan - a - SearchResults id And some instances, notably: instance Search Id Id where search _ _ i = only (FoundId i) And the error occurs on another instance: instance (Search id id) = Search id (Sig id) where search p s (IdSig i) = search p s i ... other cases here, that work The error is: Could not deduce (id ~ Id) from the context (Search id id) bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:10-45 `id' is a rigid type variable bound by the instance declaration at lib\Scion\Inspect\Find.hs:477:18 When using functional dependencies to combine Search Id Id, arising from the dependency `a - id' in the instance declaration at lib\Scion\Inspect\Find.hs:183:10 Search id Id, arising from a use of `search' at lib\Scion\Inspect\Find.hs:479:32-37 In the expression: search p s i In an equation for `search': search p s (IdSig i) = search p s i If I replace the call to search with the actual implementation of search for Id, it compiles, so at some level the code makes sense. I much prefer when error messages end with Possible fix:...! Thanks! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell IDE
The eclipseFP Help forum or mailing list is probably a better medium for EclipseFP questions than haskell-cafe, I'd say... EclipseFP uses the scion library, but comes bundled with it, so it should be able to build it (including downloading dependencies from hackage) itself without you building scion manually (if you still want to do it, there is a flag you can set to specify the version of Cabal you're using). I think you're confusing the instructions to install EclipseFP and use it to develop in Haskell with the instructions on the build page that are for people that wish to hack EclipseFP itself. Basically you need to install EclipseFP using the Eclipse install new software features and take it from there. You can of course have different workspaces, one for your haskell projects, one for your android projects, but it doesn't matter if you have projects of different types in the same workspace. Good luck, and if you're still confused feel free to contact me directly. JP On Mon, Mar 7, 2011 at 3:19 PM, David Virebayre dav.vire+hask...@gmail.com wrote: 2011/3/3 JP Moresmau jpmores...@gmail.com: Hello, I'm one of the maintainers of EclipseFP. It is a real alternative: it works, it is maintained, supported and enhanced. I use it for my own projects, and of course I use it to work on the version of the scion library that ships with it, so we eat our own dogfood :-). A new minor version is going to come out in the next couple of weeks. Why don't you give it a try? We appreciate any feedback! from http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that building scion is automatically done, but can be optionally done it it's too long. but from http://eclipsefp.sourceforge.net/build.html I see that I do have to build it. But : git clone http://github.com/JPMoresmau/scion.git Initialized empty Git repository in /data/code/scion/.git/ remote: Counting objects: 3563, done. remote: Compressing objects: 100% (1310/1310), done. remote: Total 3563 (delta 2137), reused 3342 (delta 1970) Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done. Resolving deltas: 100% (2137/2137), done. david@pcdavid:~/code$ cd scion/ david@pcdavid:~/code/scion$ sudo cabal install [sudo] password for david: Resolving dependencies... cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.* I'm not sure what to do now. Trying to install eclipsefp without scion built in case it works, but I'm not used to eclipse, I could use some screenshots to take me step by step through the process. For example, My project menu has open grayed, and file/import wants me to choose an import source (I chose Existing project into workspace) but then do I copy projects into workspace ( I did not ) I have eclipse already setup with android development (I have just a toy project, I planned to learn about android programming), when I imported the projects they appeared at the same place. Is there a way not to mix android and haskell projects ? Do I create a new workspace, or assign working sets ? Anyway the projects are in the workspace, and there's 123 warnings; but I can't really tell if the build failed or not. Selecting all the project, and right-click - refresh didn't seem to change anything. But it seems it worked, because step 7 does launch a new eclipse window, and I can see haskell in the preferences. Except that I had an error message regarding scion, and stupid me, clicked ok before I could remember what was written. I tried rebuild scion, but nothing seemed to happen. I closed the first Eclipse window (the one that has all the eclipsefp projects in the package explorer), but then the second one closed too. I lauched eclipse again, run configurations, etc and this time it looks like scion is building (well something happens in the Console tab) While this is building, I'm wondering if there's a way to launch eclise directly in the right mode. Not having to go to run configurations, etc. Ah, the build failed. Complains that HUnit is missing. So I cabal install it, close my Eclipse window, run configurations again on the first Eclipse window, and the build resumes. And build success. Now to open a haskell source file and play with Eclipse. /feedback David. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell IDE
On Thu, Mar 3, 2011 at 9:12 AM, Andrew Butterfield andrew.butterfi...@cs.tcd.ie wrote: On 3 Mar 2011, at 07:05, Hauschild, Klaus (EXT) wrote: Hi Haskellers, whats your Haskell IDE of choise? Currently I use leksah. Is the EclipseFP Plugin for Eclipse a real alternative? WinEdt*/MikTex/GHCi do leksah/EclipseFP support literate haskell programming (mix of .tex and .lhs files) ? * not to be confused with WinEdit ! Thanks Klaus Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Foundations and Methods Research Group Director. School of Computer Science and Statistics, Room F.13, O'Reilly Institute, Trinity College, University of Dublin http://www.cs.tcd.ie/Andrew.Butterfield/ EclipseFP supports lhs files. Not too sure about tex files, I know some support was built but I haven't worked on it. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell IDE
On Thu, Mar 3, 2011 at 8:05 AM, Hauschild, Klaus (EXT) klaus.hauschild@siemens.com wrote: Hi Haskellers, whats your Haskell IDE of choise? Currently I use leksah. Is the EclipseFP Plugin for Eclipse a real alternative? Thanks Klaus Hello, I'm one of the maintainers of EclipseFP. It is a real alternative: it works, it is maintained, supported and enhanced. I use it for my own projects, and of course I use it to work on the version of the scion library that ships with it, so we eat our own dogfood :-). A new minor version is going to come out in the next couple of weeks. Why don't you give it a try? We appreciate any feedback! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help!! Cannot get RandT and liftIO to work together...
Hello all, sorry I must have taken my stupid pills this morning, I cannot get the following code to compile, what am I missing? data MyState=MyState Integer newState:: (RandomGen g) = RandT g IO MyState newState = do time-liftIO getCPUTime rand-getRandomR (1,6) return $ MyState (time+rand) newStateIO :: IO MyState newStateIO = do r-getStdGen evalRandT newState r - Could not deduce (MonadIO (RandT g IO)) from the context (RandomGen g) arising from a use of `liftIO' at ...:4:15-31 Possible fix: add (MonadIO (RandT g IO)) to the context of the type signature for `newState' or add an instance declaration for (MonadIO (RandT g IO)) Pirates.hs /Pirates/src line 167 Problem But the MonadRandom docs say: Instances: MonadIOhttp://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-Monad-IO-Class.html#t:MonadIO m = MonadIOhttp://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-Monad-IO-Class.html#t:MonadIO (RandThttp://hackage.haskell.org/packages/archive/MonadRandom/0.1.6/doc/html/Control-Monad-Random.html#t:RandT g m) And the MonadIO docs say: Instances: MonadIOhttp://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-Monad-IO-Class.html#t:MonadIO IOhttp://hackage.haskell.org/packages/archive/base/4.3.1.0/doc/html/System-IO.html#t:IO So it looks to me it should work! I've also tried to replace IO by MonadIO m= in the signature, or remove all signatures. No joy. Thanks for any help. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Help!! Cannot get RandT and liftIO to work together...
GHC 6.12.1, base 4.2.0.0, MonadRandom-0.1.6, transformers-0..2.2.0, on Windows.Could it be that my system is not picking up the MonadIO I think it does? JP On Thu, Dec 23, 2010 at 4:13 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Thursday 23 December 2010 15:52:40, JP Moresmau wrote: Hello all, sorry I must have taken my stupid pills this morning, I cannot get the following code to compile, what am I missing? Works here. Which versions of the packages and GHC are you using? -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Help!! Cannot get RandT and liftIO to work together...
Thanks a million, it worked! Following all the dependencies sometimes is a bit of a headache. But in a sense, I'm happy to see I had understood how to use the monad transformer correctly, it wasn't me being (too) stupid. Thanks again! JP On Thu, Dec 23, 2010 at 4:32 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Thursday 23 December 2010 16:21:05, JP Moresmau wrote: GHC 6.12.1, base 4.2.0.0, MonadRandom-0.1.6, transformers-0..2.2.0, on Windows. Could it be that my system is not picking up the MonadIO I think it does? Probably. With 6.12.1, you'll probably have an mtl-1.* installed, so the MonadIO used by MonadRandom is not the same as the one provided by transformers. Reinstall mtl to get version 2.* and MonadRandom if that's the case. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Parse Tree
Also, Scion is a library that wraps the GHC API. It already provides things like search at location and retrieving the high level interesting elements for an outline. See http://code.google.com/p/scion-lib/ and https://github.com/JPMoresmau/scion (the outline code is only in the second repo). https://github.com/JPMoresmau/scion-- JP Moresmau http://jpmoresmau.blogspot.com/ On Tue, Dec 21, 2010 at 10:35 AM, Serguey Zefirov sergu...@gmail.comwrote: 2010/12/21 Jane Ren j2...@ucsd.edu: Does anyone know how to get the parse tree of a piece of Haskell code? Any recommended documentation? ghc as a library? http://www.haskell.org/haskellwiki/GHC/As_a_library ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is EclipseFP alive?
Yes, EclipseFP is alive, and I'm the maintainer. Yes, there are sometimes issues with installing scion due to the numerous dependencies. No, don't give up!! You don't need to build scion yourself, usually. The Java plugins include the scion sources and build it internally, setting the proper Cabal flags. If you want to build scion yourself, you need to specify that you use Cabal 1.8: cabal install -fcabal_1_8 should do the trick. There are also forums on sourceforge that I keep an eye on so you can post questions there too! Hope it helps! JP 2010/11/27 Dušan Kolář ko...@fit.vutbr.cz Hello, I tried to install EclipseFP using instructions on http://eclipsefp.sourceforge.net/, nevertheless, without any success - after downloading scion I cannot build it cabal install Resolving dependencies... cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however Cabal-1.8.0.6 was excluded because scion-0.1.0.6 requires Cabal ==1.6.* Running Setup.hs through runhaskell seems not to work as well: runhaskell Setup.hs configure Configuring scion-0.1.0.6... Setup.hs: At least the following dependencies are missing: AttoJson =0.5.2, binary ==0.5.*, derive -any, ghc-paths ==0.1.*, ghc-syb -any, ghc-syb-utils -any, hslogger ==1.0.*, list-tries -any, multiset =0.1 0.3, uniplate -any Even if, for instance: cabal info binary * binary (library) Synopsis: Binary serialisation for Haskell values using lazy ByteStrings Latest version available: 0.5.0.2 Latest version installed: 0.5.0.2 Is there any chance to make it install or should I give up? Dusan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type Directed Name Resolution
I'm totally out of my depth (coming from Java I'm probably one of these people with a weird understanding of polymorphism (-:) probably here, but I agree with Yves. It seems to me that if we accept that, in Ozgur's example, name can take either a Foo or a Bar, then his getName function could also be called name and also accept Either Foo Bar. So all of this smells strongly of type classes. So I think Yves' idea of generating a StringName type class or something, that all records with a field called name of type String are automatically instances of, and adding new instances for other types manually as need be, is good. Crazy, maybe, but good. If it quacks like a duck and has signed the duck good behavior charter aka type class definition, it's a duck. JP On Wed, Nov 10, 2010 at 1:36 PM, Yves Parès limestr...@gmail.com wrote: I think this idea is a stairway to duck typing. I exagerate, of course, but here is my point: It shouldn't be difficult to make a class: class HasName a where name :: a - String The problem is when declaring Foo and Bar instances of HasName, since you have to copy code : data Foo = Foo String data Bar = Bar String instance HasName Foo where name (Foo n) = n instance HasName Bar where name (Bar n) = n I'm sure one can automatize this using TemplateHaskell, but it is not really simple. What I mean is that GHC should give a means to automatize this kind of situation, for instance: data Foo = Foo { name :: String } (deriving HasName) Or even: data Foo = Foo { HasName.name } Just an idea. 2010/11/10 Ozgur Akgun ozgurak...@gmail.com I still don't know whether I like this idea or not, but here is the simplest definition I can think of about what it promises. Using TDNR, it will be possible to write the following code: data Foo = Foo { name :: String } data Bar = Bar { name :: String } getName :: Either Foo Bar - String getName (Left f) = name f getName (Right b) = name b However, currently you cannot: Multiple declarations of 'name' There are basically two things you can do to solve this problem. - Use different names for your functions, a la fooName, barName. This clutters up your code, and sometimes you may not have access to that part of the code. - Define these 2 data types in different modules and import qualified, a la Foo.name, Bar.name. One might still think this clutters up your code. In any case, as a programmer you need to resolve which function to use depending on types while defining 'getName'. However compiler has enough information to automate this decision for you. This is not a way to do polymorphism, this is merely a way to allow programmers define more than one function with the same name, but different types. This kinda sounds like what java people think polymorphism is :P -- Ozgur Akgun ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I still cannot seem to get a GUI working under Windows.
There are issues, yes, and you may need the MinGW tool chain to get the GUI packages to build and install properly, but it does work. I have blogged about some of my experiences, both good and bad, at http://jpmoresmau.blogspot.com/. What GUI tool specifically do you want to use? JP On Wed, Sep 29, 2010 at 5:01 PM, cas...@istar.ca wrote: I still cannot seem to get a GUI working under Windows. For Haskell GUI's is Ubuntu easier to setup. If so, we're losing people if Haskell GUI's are so hard to get working under Windows. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Disable LINE Pragma handling in GHC
Users may not want to edit the files directly, but they'll be happy to be able to open them with proper syntax highlighting, for example. JP On Sat, Sep 11, 2010 at 7:57 PM, Henning Thielemann schlepp...@henning-thielemann.de wrote: JP Moresmau schrieb: Hello fellow Haskellers, In EclipseFP we use the GHC API for IDE related stuff like syntax highlighting and code outlines. However, I ran into something funny yesterday: when a source file contains LINE pragmas ( http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/pragmas.html#line-pragma ), all the locations for tokens are changed to reflect the pragmas information. I thought that files that contain the LINE pragma usually are automatically generated files. Why would you want to edit or maintain such files in an IDE? -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Disable LINE Pragma handling in GHC
Hello fellow Haskellers, In EclipseFP we use the GHC API for IDE related stuff like syntax highlighting and code outlines. However, I ran into something funny yesterday: when a source file contains LINE pragmas ( http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/pragmas.html#line-pragma), all the locations for tokens are changed to reflect the pragmas information. While this is great in the normal' GHC usage, this is not so great for us, because we're interested in that source code, not in original code. I haven't seen any flag to turn that behavior off in the docs, nor in the Lexer code, but have I missed something? Can I tell GHC to just ignore these pragmas? I suppose even using GHC for building and something else (haskell-src-exts?) for code handling would leave us with compilation messages at the wrong place. Thanks, -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Disable LINE Pragma handling in GHC
Well, in an editor, there some operations that operate on solely on a file, and some at the project level. I would make sense to me if typechecking errors were reported against the original file (following the pragmas) while lexing and outlining results would operate without (on the actual file contents). JP On Fri, Sep 10, 2010 at 2:13 PM, Antoine Latter aslat...@gmail.com wrote: On Fri, Sep 10, 2010 at 1:40 AM, JP Moresmau jpmores...@gmail.com wrote: Hello fellow Haskellers, In EclipseFP we use the GHC API for IDE related stuff like syntax highlighting and code outlines. However, I ran into something funny yesterday: when a source file contains LINE pragmas ( http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/pragmas.html#line-pragma ), all the locations for tokens are changed to reflect the pragmas information. While this is great in the normal' GHC usage, this is not so great for us, because we're interested in that source code, not in original code. I haven't seen any flag to turn that behavior off in the docs, nor in the Lexer code, but have I missed something? Can I tell GHC to just ignore these pragmas? I suppose even using GHC for building and something else (haskell-src-exts?) for code handling would leave us with compilation messages at the wrong place. Thanks, Would you turn the behavior back on when editing .hsc files or something similar? -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Confused about ByteString, UTF8, Data.Text and sockets, still.
Hello all After reading the modules docs and some other discussions, I'm still not sure what's the best choice of tools for my problem. I'm looking at the scion server code base. At the moment, it's reading and writing on sockets using Lazy ByteStrings, then converting them to Haskell Strings using utf8-string. The Haskell Strings are then parsed as JSON using the JSon package. the response is in JSON, translated back with utf8-string to ByteStrings. This is efficient for small strings, but as I'm extending the API I have calls with much more data, and performance degrades significantly. Timings seem to point to the encoding of the String to UTF8. I have replaced JSon by AttoJson (there was also JSONb, which seems quite similar), which allows me to work solely with ByteStrings, bypassing the calls to utf8-string completely. Performance has improved noticeably. I'm worried that I've lost full UTF8 compatibility, though, haven't I? No double byte characters will work in that setup? Is Data.Text an alternative? Can I use that everywhere, including for dealing with sockets (the API only mentions Handle). Should I use Data.ByteString.UTF8 everywhere, rewriting the JSON parser to deal with this instead of the Word8 ByteStrings? In short, what's the fastest way to implement receiving/sending UTF8 text across sockets? Thanks for any pointer, -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How easy is it to hire Haskell programmers
On Fri, Jul 2, 2010 at 12:34 PM, Duncan Coutts dun...@well-typed.comwrote: When we are done we intend to write up a blog post more details, e.g. numbers and the range/distribution of experience among candidates. I hope that will be useful to people who are interested in hiring Haskell programmers. It would also be useful to people who are interested in being hired as a Haskell programmer, so they know where to send the hitmen, I mean, what to do to improve. -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Has anybody tried to upgrade Cabal on HP (Win 7)
On Fri, Jun 18, 2010 at 4:48 PM, Daniel Kahlenberg d.kahlenb...@googlemail.com wrote: Hello, I recently installed HP 2010.1.0.0 within Windows 7 and wanted to upgrade the Cabal package to 1.8.0.6 today, sadly I got stuck on a failure building the directory package. So I tried to isolate the messages a bit and gave the following a try in a ghci session (1st time only with path to cygwin binaries/2nd time only with path to msys binaries added on my path variable, for both times I append the logging output): Prelude System.Cmd rawSystem cabal [upgrade, --constraint=base==4.*, directory, -v3, --user, --build-log=d:/temp/log/build-$$pkgid-$$compiler.log] Maybe we can find the cause?! Greetz Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe I see on the gcc command line: -IC:\\Program Files (x86)\\Haskell Platform\\2010.1.0.0/include On my machine, HsFFI.h is in lib/include, so maybe try with --extra-include-dirs=-IC:\\Program Files (x86)\\Haskell Platform\\2010.1.0.0\\lib\\include I also ran into problems with the directory package on windows, that I got around by making sure every thing was installed with --global -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Order of arguments to GCC when building SDL on Windows with Cabal
Hello, I've been trying for a while to build the SDL haskell library on windows. People have told me it worked for them, but I can't get to work for the life of me. I have the latest Haskell Platform, I think more or less the latest MINGW and MSYS tools. I'm on Windows 7 64 bits. I installed the SDL library without hassle, and the samples work. It's only the haskell library that's bothering me. I've modified the .cabal file as indicated for Windows (extra-include-dirs, extra-lib-dirs), and runhaskell Setup configure. But then runhaskell Setup build fails with: Preprocessing library SDL-0.5.9... dist\build\Graphics\UI\SDL\General_hsc_make.o:General_hsc_make.c:(.text +0x29): m ultiple definition of `main' d:/dev/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../ libmingw32.a(main.o):main.c:( .text+0x0): first defined here D:\dev\SDL-1.2.14\lib/libSDLmain.a(SDL_win32_main.o): In function `console_main' : /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:315: undefined r eference to `SDL_main' collect2: ld returned 1 exit status linking dist\build\Graphics\UI\SDL\General_hsc_make.o failed command was: d:\dev\MinGW\bin\gcc.exe -LD:\dev\SDL-1.2.14\lib -L/usr/ lib -lmingw 32 -lSDLmain -lSDL -mwindows -LD:\dev\haskell\HaskellPlatform \2010.1.0.0\base-4. 2.0.0 -lwsock32 -luser32 -lshell32 -LD:\dev\haskell\HaskellPlatform \2010.1.0.0\i nteger-gmp-0.2.0.0 -LD:\dev\haskell\HaskellPlatform\2010.1.0.0\ghc- prim-0.2.0.0 -LD:\dev\haskell\HaskellPlatform\2010.1.0.0 -LD:\dev\haskell \HaskellPlatform\201 0.1.0.0/gcc-lib -lm -lwsock32 -LD:\dev\haskell\HaskellPlatform \2010.1.0.0 dist\b uild\Graphics\UI\SDL\General_hsc_make.o -o dist\build\Graphics\UI\SDL \General_hs c_make.exe (I have the same error with the gcc inside the Haskell Platform, the same error running in a windows shell without MSYS on the path, in the MSYS bash with MSYS on the path). And I figured out what's wrong with that line after thinking for a while (as in, several days...): basically the line says something like gcc sdl-flags file.o -o file.exe. If I revert the order of the arguments and run gcc file.o -o file.exe sdl-flags, it works! The gcc documentation explains that the libraries are searched in the order they appear (http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html), so to put the libraries you depend on after the code that has the dependencies. And I can see that building the SDL samples indeed puts the .c file before the sdl linker flags. So this seems to be my problem. What's the solution? 1. I've done something stupid or forgot some essential MINGW tool that would make my system not dependent on the order of the arguments to gcc? I've tried with gcc 3.4.5 and gcc 4.5.0, same result. 2. I can hack somewhere (where???) the command passed on to GCC when building? Maybe some voodoo in the cabal file? 3. I can get runhaskell Setup build to only dump the commands it's going to run, modify them in my favorite text editor and run them manually (as said above, I've managed to create the first exe required but build insists on rebuilding it even if present) 4. ...? The fact that some people managed seem to point with a problem with my config, but it's seems reasonnably clean to me, and I've even managed to install wxWidgets and wxHaskell... Any help appreciated! -- JP Moresmau http://jpmoresmau.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Best Editor In Windows
Hello I've been working on eclipse-fp to bring it up to working order again, so if you like Eclipse, you can download the source from git://github.com/JPMoresmau/eclipsefp.git (hopefully there will be a binary release soon). This is based on my customized Scion library (git://github.com/JPMoresmau/scion.git). I'm using Windows myself. JP Moresmau ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe