Re: [Haskell-cafe] Encoding of Haskell source files
On Mon, 2011-04-04 at 11:50 +0200, Roel van Dijk wrote: I am not aware of any algorithm that can reliably infer the character encoding used by just looking at the raw data. Why would people bother with stuff like ?xml version=1.0 encoding=UTF-8? if automatically figuring out the encoding was easy? It is possible, if the syntax/grammar of the encoded content restricts the set of allowed code-points in the first few characters. For instance, valid JSON (see RFC 4673 section 3) requires the first two characters to be plain ASCII code-points, thus which of the 5 BOM-less UTF-encodings is used is uniquely determined by inspecting the first 4 bytes of the UTF encoded stream. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
On 5 April 2011 07:04, Mark Lentczner mark.lentcz...@gmail.com wrote: I'm not on that mailing list, so I'll comment here: I recommend joining the prime list. It is very low traffic and the place where language changes should be discussed. My only caveat is that the encoding provision should apply when Haskell source is presented to the compiler as a bare stream of octets. Where Haskell source is interchanged as a stream of Unicode characters, then encoding is not relevant -- but may be likely governed by some outer protocol - and hence may not be UTF-8 but nonetheless invisible at the Haskell level. My intention is that every time you need an encoding for Haskell sources, it must be UTF-8. At least if you want to call it Haskell. This is not limited to compilers but concerns all tools that process Haskell sources. Two examples where this might come into play are: 1) An IDE that stores module source in some database. It would not be relevant what encoding that IDE and database choose to store the source in if the source is presented to the integrated compiler as Unicode characters. An IDE and database are free to store sources any way they see fit. But as soon as you want to exchange that source with some standards conforming system it must be encoded as UTF-8. 2) If a compilation system fetches module source via HTTP (I could imagine a compiler that chased down included modules directly off of Hackage, say), then HTTP already has a mechanism (via MIME types) of transmitting the encoding clearly. As such, there should be no problem if that outer protocol (HTTP) transmits the source to the compiler via some other encoding. There is no reason (and only potential interoperability restrictions) to enforce that UTF-8 be the only legal encoding here. This is an interesting example. What distinguishes this scenario from others is that there is a clear understanding between two parties (client and server) how a file should be interpreted. I could word my proposal in such a way that it only concerns situations where such a prior agreement doesn't or can't exist. For example, when storing source on a file system. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems porting ghc6-6.10.1 to GNU/Hurd using 6.8.2
Hi, I'm currently trying to upgrade Debian GNU/Hurd ghc6.8.2 to 6.10.1 (and further from there, due to requirements of ghc and haddock versions), and get stuck on configuring the random-1.0.0.1 library in stage1. I have tried versions of ghc6 are 6.10.1+dfsg1-1 to 6.10.1+dfsg1-5 (the latest not requiring ghc6.10 due to haddock 2.4.2). The commands are shown below: (added the -verbose=3 parameter) cd ghc6-6.10.1+dfsg1/libraries (sorry for the missing \ due to cut-and-paste to the mailer) ( cd random /home/srs/DEBs/ghc/ghc6-6.10.1+dfsg1/libraries/cabal-bin --verbose=3 /usr/bin/ghc6 /home/srs/DEBs/ghc/ghc6-6.10.1 +dfsg1/libraries/bootstrapping.conf configure --verbose=3 --prefix=/NONEXISTENT --bindir=/NONEXISTENT --libdir=/NONEXISTENT --libexecdir=/NONEXISTENT --datadir=/NONEXISTENT --docdir=/NONEXISTENT --haddockdir=/NONEXISTENT --htmldir=/NONEXISTENT --with-compiler=/home/srs/DEBs/ghc/ghc6-6.10.1 +dfsg1/ghc/stage1-inplace/ghc --with-hc-pkg=/home/srs/DEBs/ghc/ghc6-6.10.1 +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg --libsubdir='$pkgid' --with-gcc=gcc --with-ld=/usr/bin/ld --with-hscolour=/usr/bin/HsColour --with-alex=/usr/bin/alex --with-happy=/usr/bin/happy --configure-option='--build' --configure-option='i486-gnu' --configure-option='--prefix=/usr' --configure-option='--with-ghc=/usr/bin/ghc6' --configure-option='build_alias=i486-gnu' --configure-option='CFLAGS=-g -O2' --configure-option='LDFLAGS=' --configure-option='CPPFLAGS=' --configure-option=--with-cc=gcc --with-hsc2hs=/home/srs/DEBs/ghc/ghc6-6.10.1 +dfsg1/utils/hsc2hs/install-inplace/bin/hsc2hs --haddock-options=--use-contents=../index.html --use-index=../doc-index.html --enable-library-profiling --enable-split-objs ) touch stamp/configure.library.build-profiling-splitting.random || touch random/unbuildable Output: === Creating dist (and its parents) (/home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/ghc/stage1-inplace/ghc,[--numeric-version]) /home/srs/DEBs/ghc/ghc6-6.10.1+dfsg1/ghc/stage1-inplace/ghc is version 6.10.1 (/home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg,[--version]) /home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg is version 6.10.1 (/home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/ghc/stage1-inplace/ghc,[--supported-languages]) Reading installed packages... (/home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg,[dump,--global]) Hangs here! Running manually works OK!! /home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg dump --global Gives a lot of output here... Below is the ghc-pkg script: cat /home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/bin/ghc-pkg PKGCONF=/home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/inplace-datadir/./package.conf exec /home/srs/DEBs/ghc/ghc6-6.10.1\ +dfsg1/utils/ghc-pkg/install-inplace/libexec/ghc-pkg --global-conf\ $PKGCONF ${1+$@} I've tried changing the shell from dash to bash but no changes. I also tried to escape some of the variables in the gkc-pkg shell script but without any luck. Anybody can help me here?? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] broken on build encoding
On Tuesday 05 April 2011 03:07:31, Gang Yu wrote: Hi Daniel, To circumvent the build failure, have an mtl-1.*, but no mtl-2.* available, then it should build (or you could edit the source to replace all occurrences of the data constructor State with the function state to make it build with mtl-2.*). It does not work, I cleaned up my ghc and unregistered the mtl-2.0.1.0, then reinstall encoding, it gets the following failure: [ 6 of 65] Compiling Data.Encoding.ByteSource ( Data/Encoding/ByteSource.hs, dist/build/Data/Encoding/ByteSource.o ) Data/Encoding/ByteSource.hs:131:9: No instance for (Monad (Either DecodingException)) snip cabal: Error: some packages failed to install: encoding-0.6.4 failed during the building phase. The exception was: ExitFailure 1 That seems to be related to a change in Monad instances, formerly, there was an instance (Error e) = Monad (Either e) where ... defined in Control.Monad.Error, now there's an instance Monad (Either e) where ... defined in Control.Monad.Instances. So in Data.Encoding.ByteSource, there's an instance Monad (Either DecodingException) where ... but that wouldn't work with the new instance, so it's conditionally included per #ifndef MIN_VERSION_mtl(2,0,0,0) instance Monad (Either DecodingException) where ... #endif Apparently that doesn't work as expected, probably should be #if !MIN_VERSION_mtl(2,0,0) Short of changing the code, try installing encoding-0.6.3; that built with ghc-6.12 on hackage, so it should work for you. gang@gang-laptop:~$ ghc-pkg list /var/lib/ghc-6.12.1/package.conf.d directory-1.0.1.0 /home/gang/.ghc/i386-linux-6.12.1/package.conf.d directory-1.1.0.0 Unrelated, but that looks like trouble waiting for an opportunity to bite you. Thanks Gang ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
On Tuesday 05 April 2011 04:35:39, Richard O'Keefe wrote: On 4/04/2011, at 10:24 PM, Daniel Fischer wrote: Colin spoke of *leading* characters, for .hs files, that drastically reduces the possibilities - not for .lhs, though. A .hs file can, amongst other things, begin with any small letter. D'oh, yes, I always forget that a module declaration isn't required. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] broken on build encoding
On Tue, Apr 5, 2011 at 5:10 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: Short of changing the code, try installing encoding-0.6.3; that built with ghc-6.12 on hackage, so it should work for you. Thanks, Daniel, it does work. I summarize as bundle of ghc-6.12 mtl-1.1(no mtl-2) encoding-0.6.3 works Gang ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems with haskell98 package in GHC
Hello, I recently tried upgrading the package haskell98 to version 1.1.0.1. Two things went wrong: (1) Some of the time the build failed because it said it couldn't build time-1.2.0.4 (which I already had installed) (2) Even when I finally managed to get it to build and install, compiling code led to this error message: Bad interface file: /usr/local/lib/haskell98-1.1.0.1/ghc-6.12.3/IO.hi Something is amiss; requested module haskell98:IO differs from name found in the interface file haskell98-1.1.0.1:IO I'm running GHC version 6.12.3. Any help much appreciated. Julian Porter julian.por...@porternet.org http://about.me/julian.porter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems with haskell98 package in GHC
On Tuesday 05 April 2011 14:20:52, Julian Porter wrote: Hello, I recently tried upgrading the package haskell98 to version 1.1.0.1. Don't. Basically, don't upgrade any libraries that come with GHC itself (afaik, Cabal can be upgraded without causing havoc, everything(?) else should only be upgraded when you know exactly what you're doing). Two things went wrong: (1) Some of the time the build failed because it said it couldn't build time-1.2.0.4 (which I already had installed) time is one of GHC's bootlibs, it shouldn't be upgraded either. You'll get some stuff depending on the original time and other stuff depending on the new one, it won't work together, so things will break - unless you know exactly what you're doing. (2) Even when I finally managed to get it to build and install, compiling code led to this error message: Bad interface file: /usr/local/lib/haskell98-1.1.0.1/ghc-6.12.3/IO.hi Something is amiss; requested module haskell98:IO differs from name found in the interface file haskell98-1.1.0.1:IO Something expected the haskell98 package that came with GHC and found the newly installed, it seems. Looks like you've done a global install and thus have overwritten the original. I'm afraid that means you have to reinstall GHC, I know of no way to fix it. I'm running GHC version 6.12.3. Any help much appreciated. Julian Porter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
Hi Johan. Excerpts from Johan Tibell's message of Seg Mar 28 10:58:16 -0300 2011: (...) If you're a student and like to get paid to work on a Haskell project this summer I recommend you go find an interesting project [1] and start working on your application. I plan to apply to the Google Summer of Code, to work on the parallelization of Cabal Install. As stated in some comments, this project may be too small for three months, so I included some other things in my proposal. The first is to work on making GHC parallel while building different modules. The second is to make a tool that I'm creating, hackage-debian, parallel. I intend to hackage-debian before the deadline for project submissions. It's a tool to create a debian repository with as much as possible hackage libraries. I've writed a draft of the proposal at http://www2.dcc.ufmg.br/laboratorios/llp/wiki/doku.php?id=marco_soc2011 . If you have any comments, I'll be glad to receive them. Greetings. (...) -- marcot http://marcot.eti.br/ signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
On 5 April 2011 15:17, Marco Túlio Gontijo e Silva mar...@marcot.eti.brwrote: I plan to apply to the Google Summer of Code, to work on the parallelization of Cabal Install. As stated in some comments, this project may be too small for three months, so I included some other things in my proposal. The first is to work on making GHC parallel while building different modules. I'm sure everyone is eager to have a parallel GHC and parallel Cabal. I am. Waiting for 67 modules to build in order every time I change my types file is not fun. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
2011/4/5 Christopher Done chrisd...@googlemail.com: On 5 April 2011 15:17, Marco Túlio Gontijo e Silva mar...@marcot.eti.br wrote: I plan to apply to the Google Summer of Code, to work on the parallelization of Cabal Install. As stated in some comments, this project may be too small for three months, so I included some other things in my proposal. The first is to work on making GHC parallel while building different modules. I'm sure everyone is eager to have a parallel GHC and parallel Cabal. I am. Waiting for 67 modules to build in order every time I change my types file is not fun. You should parallelize yourself instead; while one thread is stuck waiting for GHC or Cabal, the other ones can have fun. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
On 5 April 2011 15:33, Vo Minh Thu not...@gmail.com wrote: I'm sure everyone is eager to have a parallel GHC and parallel Cabal. I am. Waiting for 67 modules to build in order every time I change my types file is not fun. You should parallelize yourself instead; while one thread is stuck waiting for GHC or Cabal, the other ones can have fun. I only came to look at Haskell-Cafe posts because I was waiting for builds. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using _ on the RHS of an equation?
Hi Jason, I like the idea. I've seen some code from Oleg Kiselyov which uses __ (two underscores) in this way. The thing that stops me though, is when I get it wrong, and undefined fires somewhere, but I don't know where. Something like you propose, but with a line number, would be sweet. Paul The University of Glasgow, charity number SC004401 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
Hi Marco On Tue, Apr 5, 2011 at 3:17 PM, Marco Túlio Gontijo e Silva mar...@marcot.eti.br wrote: I've writed a draft of the proposal at http://www2.dcc.ufmg.br/laboratorios/llp/wiki/doku.php?id=marco_soc2011 . If you have any comments, I'll be glad to receive them. Thanks for taking the time to put together such a well-written proposals. I have two comments at this point: If not all of the dependencies were build yet, the dependencies are included in the queue, and also the package or module, after them. Minor nit: note that several packages can share a dependency so naively adding a dependency to the queue could cause unnecessary rebuilds. I'll work on a released version of GHC, to avoid having to rebuild it whenever the git is updated, and to avoid handling with changed on the git tree during my development. I would strongly recommend against this as you might end up with an impossible merge towards the end of the project, putting the whole project in jeopardy. I'd suggest getting patches in early and frequently. By submitting patches (at least for review) early and often you'll benefit from feedback and buy-in from the maintainer(s) and make it easier for him/her/they to merge your work. Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems with haskell98 package in GHC
Looks like you've done a global install and thus have overwritten the original. I'm afraid that means you have to reinstall GHC, I know of no way to fix it. Thank you for the explanation. Fortunately, the old version was still there in its own folder, so was able to unregister the new one and re-expose the old. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using _ on the RHS of an equation?
It's quite hacky, but this can be done with CPP and quasiquoting (incidentally, it would be _REALLY_ nice if 'undefined' and 'error' had similar source-location-dependent error messages by default): https://github.com/mokus0/junkbox/commit/bad59f486c3457f1d880a1cfa5b1baa33aff4ade -- James ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using _ on the RHS of an equation?
On 5 April 2011 18:00, James Cook mo...@deepbondi.net wrote: It's quite hacky, but this can be done with CPP and quasiquoting (incidentally, it would be _REALLY_ nice if 'undefined' and 'error' had similar source-location-dependent error messages by default): https://github.com/mokus0/junkbox/commit/bad59f486c3457f1d880a1cfa5b1baa33aff4ade #define undefined [underscore|undefined at line __LINE__ in __FILE__|] That's nice, I like it. Wanted something like this for a while. I rarely get exceptions in Haskell so that it's not even a bother when I don't know what line number an exception came from, even undefined, but it's nice to have it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
On 5 April 2011 10:35, Daniel Fischer daniel.is.fisc...@googlemail.comwrote: On Tuesday 05 April 2011 04:35:39, Richard O'Keefe wrote: On 4/04/2011, at 10:24 PM, Daniel Fischer wrote: Colin spoke of *leading* characters, for .hs files, that drastically reduces the possibilities - not for .lhs, though. A .hs file can, amongst other things, begin with any small letter. D'oh, yes, I always forget that a module declaration isn't required. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe True, but we could say that UTF-8 is complusory in the absence of a module declaration. -- Colin Adams Preston, Lancashire, ENGLAND () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems porting ghc6-6.10.1 to GNU/Hurd using 6.8.2
On Tue, 2011-04-05 at 09:43 +0200, Svante Signell wrote: Hi, I'm currently trying to upgrade Debian GNU/Hurd ghc6.8.2 to 6.10.1 (and further from there, due to requirements of ghc and haddock versions), and get stuck on configuring the random-1.0.0.1 library in stage1. I have tried versions of ghc6 are 6.10.1+dfsg1-1 to 6.10.1+dfsg1-5 (the latest not requiring ghc6.10 due to haddock 2.4.2). The commands are shown below: (added the -verbose=3 parameter) ... Output: === Creating dist (and its parents) (.../ghc/stage1-inplace/ghc,[--numeric-version]) .../ghc/stage1-inplace/ghc is version 6.10.1 (.../utils/ghc-pkg/install-inplace/bin/ghc-pkg,[--version]) .../utils/ghc-pkg/install-inplace/bin/ghc-pkg is version 6.10.1 (.../ghc/stage1-inplace/ghc,[--supported-languages]) Reading installed packages... (.../utils/ghc-pkg/install-inplace/bin/ghc-pkg,[dump,--global]) Hangs here! Running manually works OK!! $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg --global-conf $pwd/inplace-datadir/./package.conf dump --global Gives a lot of output here... Below is the ghc-pkg script: cat $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg PKGCONF=$pwd/inplace-datadir/./package.conf exec $pwd/utils/ghc-pkg/install-inplace/libexec/ghc-pkg --global-conf $PKGCONF ${1+$@} I've tried changing the shell from dash to bash but no changes. I also tried to escape some of the variables in the gkc-pkg shell script but without any luck. Anybody can help me here?? Any pointers, or ideas how to make some progress. Other mailing lists? It hangs at the same place independent of settings. like splitobjs, profile or not, etc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems porting ghc6-6.10.1 to GNU/Hurd using 6.8.2
On Tue, Apr 5, 2011 at 2:02 PM, Svante Signell svante.sign...@telia.comwrote: On Tue, 2011-04-05 at 09:43 +0200, Svante Signell wrote: Hi, I'm currently trying to upgrade Debian GNU/Hurd ghc6.8.2 to 6.10.1 (and further from there, due to requirements of ghc and haddock versions), and get stuck on configuring the random-1.0.0.1 library in stage1. I have tried versions of ghc6 are 6.10.1+dfsg1-1 to 6.10.1+dfsg1-5 (the latest not requiring ghc6.10 due to haddock 2.4.2). The commands are shown below: (added the -verbose=3 parameter) ... Output: === Creating dist (and its parents) (.../ghc/stage1-inplace/ghc,[--numeric-version]) .../ghc/stage1-inplace/ghc is version 6.10.1 (.../utils/ghc-pkg/install-inplace/bin/ghc-pkg,[--version]) .../utils/ghc-pkg/install-inplace/bin/ghc-pkg is version 6.10.1 (.../ghc/stage1-inplace/ghc,[--supported-languages]) Reading installed packages... (.../utils/ghc-pkg/install-inplace/bin/ghc-pkg,[dump,--global]) Hangs here! Running manually works OK!! $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg --global-conf $pwd/inplace-datadir/./package.conf dump --global Gives a lot of output here... Below is the ghc-pkg script: cat $pwd/utils/ghc-pkg/install-inplace/bin/ghc-pkg PKGCONF=$pwd/inplace-datadir/./package.conf exec $pwd/utils/ghc-pkg/install-inplace/libexec/ghc-pkg --global-conf $PKGCONF ${1+$@} I've tried changing the shell from dash to bash but no changes. I also tried to escape some of the variables in the gkc-pkg shell script but without any luck. Anybody can help me here?? Any pointers, or ideas how to make some progress. Other mailing lists? It hangs at the same place independent of settings. like splitobjs, profile or not, etc. I would try the ghc users mailing list[1] or the Debian GNU/Hurd lists[2] (maybe other programs have similar failures on that platform?). The last time I tried Debian Hurd was circa 2003 and lots of things were in flux and broken. So, I have a hunch you're on your own to some extent. Have you tried debugging tools like strace? Good luck! Jason [1] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users http://www.haskell.org/mailman/listinfo/glasgow-haskell-users[2] http://www.debian.org/ports/hurd/hurd-contact http://www.debian.org/ports/hurd/hurd-contact ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: stm-chans: Additional types of channels for STM.
On 4/3/11 11:58 PM, Thomas DuBuisson wrote: Wren, Glad to see someone is doing a more complete packaging of STM helpers and derivatives! I've done a little work on bounded TChans[1] (hackage bounded-tchan package) and I think you should consider a few things: Ah, somehow I missed that in my searching. I'll give it a look and try to integrate things. 1) Split the reader counter and writer counters as I've done in bounded-tchan. This gives 2-5 times better performance (I benchmarked using Criterion, a single reader, a single writer, and tested channels with bounds of 10, 100, and 1000 elements). That's crazy. I wonder why... must be a contention issue... 2) Implement a tryWriteTBChan for obvious reasons. Good idea. 4) Help me figure out a good way to build dupTBChan [2]. It's not easy. I've yet to figure out a way of doing this that has the right semantics. Perhaps splitting the reader and writer counters will help, though it sounds like you haven't had much luck either. [2] http://stackoverflow.com/questions/5446484/how-to-add-a-finalizer-on-a-tvar Have you taken a look at TwilightSTM? http://proglang.informatik.uni-freiburg.de/projects/syncstm/ http://hackage.haskell.org/package/twilight-stm Since I'm aiming to have stm-chans eventually incorporated into stm proper, that wouldn't work for me, though it sounds like it might solve the ideological question about adding finalizers to TVars -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using _ on the RHS of an equation?
On 4/4/11 4:42 PM, Jason Dagit wrote: Is this something people would be interested in having as an extension in GHC? Or is it just too fluffy for anyone to really care? I'd much rather have _ on the RHS of equations be a way of specifying terms that the compiler should infer. This is pretty standard for dependently typed languages, and more closely mimics the behavior of _ on the LHS as a gensym-named pattern variable. For Haskell we could perhaps use Djinn to infer the term and have compilation fail if there isn't a unique total function/value that can be inferred for the missing term. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using _ on the RHS of an equation?
On 6 April 2011 13:13, wren ng thornton w...@freegeek.org wrote: On 4/4/11 4:42 PM, Jason Dagit wrote: Is this something people would be interested in having as an extension in GHC? Or is it just too fluffy for anyone to really care? I'd much rather have _ on the RHS of equations be a way of specifying terms that the compiler should infer. This is pretty standard for dependently typed languages, and more closely mimics the behavior of _ on the LHS as a gensym-named pattern variable. Can you provide an example of this behaviour? For Haskell we could perhaps use Djinn to infer the term and have compilation fail if there isn't a unique total function/value that can be inferred for the missing term. Doesn't Djinn also return a function in cases where there is more than one possible value? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ncurses trouble
I'm having trouble using Haskell and ncurses Mac OS X (10.6.6 to be precise). GHC 6.12.3 gives me a lot of trouble, and GHC 7.0.2 even more. rogue.hs, is a text adventure game in the works. $ cat rogue.hs {-# LANGUAGE OverloadedStrings #-} import Data.Text import UI.NCurses main :: IO () main = runCurses $ do win - defaultWindow updateWindow win $ do moveCursor 10 10 drawText Hello world! Hit 'q' to exit render waitForQ win waitForQ :: Window - Curses () waitForQ win = do ev - getEvent win Nothing case ev of Just (EventCharacter 'q') - return () _ - waitForQ win $ sudo port install ncurses ncursesw $ cabal install ncurses Resolving dependencies... Configuring ncurses-0.2... cabal: c2hs version =0.15 is required but it could not be found. cabal: Error: some packages failed to install: ncurses-0.2 failed during the configure step. The exception was: ExitFailure 1 Hmm. Cabal couldn't find a solution to the c2hs dependency. So I install it manually. $ cabal install c2hs $ cabal install ncurses Resolving dependencies... Configuring ncurses-0.2... cabal: Missing dependency on a foreign library: * Missing C library: ncursesw This problem can usually be solved by installing the system package that provides this library (you may need the -dev version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. cabal: Error: some packages failed to install: ncurses-0.2 failed during the configure step. The exception was: ExitFailure 1 MacPorts' ncurses isn't detected by Haskell, so I use Homebrew's. $ brew install ncursesw $ ghc --make -o rogue rogue.hs [2 of 2] Compiling Main ( rogue.hs, rogue.o ) Linking rogue ... ld: warning: in /usr/local/lib/libncursesw.dylib, file was built for unsupported file format which is not the architecture being linked (i386) It appears that the Homebrew ncurses library is x86, and GHC is x86_64, or vice-versa. $ sudo port install ncurses +universal $ sudo port install ncursesw +universal $ brew install --universal ncursesw These don't visibly improve compilation in any way. I thought updating Haskell would fix the problem. $ wget http://lambda.galois.com/hp-tmp/2011.2.0.0/Haskell%20Platform%202011.2.0.0-i386.pkg $ sudo installer -pkg Haskell Platform 2011.2.0.0-i386.pkg -target / $ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.0.2 $ cabal --version cabal-install version 0.10.2 using version 1.10.1.0 of the Cabal library But it only made the problem worse. Now ncurses won't even build. $ cabal install ncurses Resolving dependencies... Configuring ncurses-0.2... Preprocessing library ncurses-0.2... Building ncurses-0.2... [1 of 4] Compiling UI.NCurses.Enums ( dist/build/UI/NCurses/Enums.hs, dist/build/UI/NCurses/Enums.o ) [2 of 4] Compiling UI.NCurses.Types ( UI/NCurses/Types.hs, dist/build/UI/NCurses/Types.o ) [3 of 4] Compiling UI.NCurses ( dist/build/UI/NCurses.hs, dist/build/UI/NCurses.o ) [4 of 4] Compiling UI.NCurses.Panel ( dist/build/UI/NCurses/Panel.hs, dist/build/UI/NCurses/Panel.o ) UI/NCurses/Panel.chs:49:1: Warning: The import of `UI.NCurses' is redundant except perhaps to import instances from `UI.NCurses' To import instances alone, use: import UI.NCurses() hsncurses-shim.c:5:29: error: ncursesw/curses.h: No such file or directory cabal: Error: some packages failed to install: ncurses-0.2 failed during the building phase. The exception was: ExitFailure 1 I'd settle for using hscurses, but it won't compile with GHC 7, and it has its own internal bugs besides. $ cabal install hscurses Resolving dependencies... Configuring hscurses-1.4.0.0... configure: WARNING: unrecognized options: --with-gcc checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for addnstr in -lcurses... yes checking for addnstr in -lncurses... yes checking for waddnwstr in -lncursesw... yes checking for iconv in -liconv... yes checking for libiconv in -liconv... yes checking for libiconv... yes checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking iconv.h usability... yes checking
Re: [Haskell-cafe] Using _ on the RHS of an equation?
On 4/5/11 11:22 PM, Ivan Lazar Miljenovic wrote: On 6 April 2011 13:13, wren ng thorntonw...@freegeek.org wrote: On 4/4/11 4:42 PM, Jason Dagit wrote: Is this something people would be interested in having as an extension in GHC? Or is it just too fluffy for anyone to really care? I'd much rather have _ on the RHS of equations be a way of specifying terms that the compiler should infer. This is pretty standard for dependently typed languages, and more closely mimics the behavior of _ on the LHS as a gensym-named pattern variable. Can you provide an example of this behaviour? Which behavior, the LHS or RHS? A canonical example for inferring RHS terms is handling the passing of implicit arguments, e.g. the types passed in System F. Haskell already does this inference for type passing--- though Haskell lacks the explicit form that System F has for doing so. Another example is the inferences for passing around type-class dictionaries. In Haskell-as-specified this isn't how it works, but it would be easy to imagine a variant of Haskell where type-class constraints are just there for inferring the implicit dictionary argument--- which would allow us to unify the implementations of functions which take a parameter (e.g., an equivalence predicate) and those which take a type-class from which they extract the parameter (e.g., taking an Eq dictionary in order to use (==)). Languages like Coq, Agda, Epigram, etc combine these ideas about implicit argument passing and inference into a single system and extend it to allow inferring all terms, not just types and type-class dictionaries. For Haskell we could perhaps use Djinn to infer the term and have compilation fail if there isn't a unique total function/value that can be inferred for the missing term. Doesn't Djinn also return a function in cases where there is more than one possible value? I was just pointing out Djinn as prior art. In principle it shouldn't be too hard to adjust it to complain when there are multiple solutions. Of course, we'd have to define multiple solutions in order to avoid counting multiple terms which all normalize to the same thing; which is undecidable in general since Haskell allows non-terminating functions. But, in practice, we only need a semi-decidable inference mechanism; it's fine for the compiler to give up and force the programmer to supply the term. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe