Re: [Haskell-cafe] hledger subcommand detection, RFC
On 27 August 2011 00:23, Simon Michael si...@joyful.com wrote: Thanks Conrad! Those are some great links. I wrapped up some manpage generation code in a package called ui-command, which is kind of orthogonal to cmdargs (ui-command just deals with subcommands). Example commands are often useful, so I added Interesting. Have you tried using both ui-command and cmdargs together ? No, I've generally just used ui-command to select (and document) subcommands, and GetOpt to handle arguments. I think cmdargs added support for selecting subcommands recently. In any case, you are selecting subcommands by searching the filesystem. Perhaps it would be a good idea to split out the documentation part of ui-command ... Conrad. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic loading of module
Thanks again for your patience and efforts. I am pretty sure I did not remove anything from the global package scope, at least intentionally. But of course I may have done things whcih you did not recommend. Here is the command-line history: ghc-pgk unregister --user template-haskell ghc-pkg unregister --user template-haskell ghc-pkg unregister --force --user template-haskell ghc-pkg unregister --force --user quickcheck ghc-pkg unregister --force --user QuickCheck ghc-pkg unregister --force --user template-haskell cd C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\ dir c: dir cd package.conf.d dir cd .. rm -fr package.conf.d d: ghc-pkg check ghc-pkg update ghc-pkg recache Regards, Arnaud On Mon, Aug 29, 2011 at 4:03 AM, Albert Y. C. Lai tre...@vex.net wrote: On 11-08-28 04:40 PM, Arnaud Bailly wrote: Hello Albert, Thanks for taking the time to help me fix this package stuff. So I wiped out my package.conf.d/ and tried to reinstall my stuff. Installing template-haskell 2.5.0.0 is ok (2.6 is not, fails to compile on ghc 7.0.3) but then: D:\projets\ghc --make -package ghc main command line: cannot satisfy -package ghc (use -v for more information) I suspect I really *do* have to reinstall haskell-platform. Here is the output of ghc-pkg list -v: using cache: C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\**package.conf.d\package.cache using cache: D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d\package.cache D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d: Cabal-1.10.1.0 (Cabal-1.10.1.0-**55f781465ee9f32289755ad706c71f**0f) GLUT-2.1.2.1 (GLUT-2.1.2.1-**2d30997b9a19d27be388572e75af52**bf) HTTP-4000.1.1 (HTTP-4000.1.1-**267a332938fa742ba5a5d59de0b46d**60) HUnit-1.2.2.3 (HUnit-1.2.2.3-**102fbfbd594cd6d38461f5c68d8809**96) OpenGL-2.2.3.0 (OpenGL-2.2.3.0-**a58ce3ad6070e6b7932a3e779be57f**75) Win32-2.2.0.1 (Win32-2.2.0.1-**26cf39fdf591bdac61b11d5a443c62**ab) array-0.3.0.2 (array-0.3.0.2-**8e9cd0144e87fa9cc86cc9031631c4**f3) base-4.3.1.0 (base-4.3.1.0-**f520cd232cc386346843c4a12b63f4**4b) bin-package-db-0.0.0.0 (bin-package-db-0.0.0.0-**97d865e5935b41538bcb29fc1040ae**7d) bytestring-0.9.1.10 (bytestring-0.9.1.10-**cd85f14e02463c02ba4c77d7adcdb5**4f) cgi-3001.1.7.4 (cgi-3001.1.7.4-**659440ce11c2975fd9c9c471a1e8ff**3b) containers-0.4.0.0 (containers-0.4.0.0-**18deac99a132f04751d862b77aab13**6e) deepseq-1.1.0.2 (deepseq-1.1.0.2-**09b3aed0c4982bbc6569c668100876** fa) directory-1.1.0.0 (directory-1.1.0.0-**3a2367d72569467a8af8a231656ff1 **b8) extensible-exceptions-0.1.1.2 (extensible-exceptions-0.1.1.**2-**d8c5b906654260efd7249f497d17a8**31) ffi-1.0 (builtin_ffi) fgl-5.4.2.3 (fgl-5.4.2.3-**595811d6eabb1e1768685703ea66e9**82) filepath-1.2.0.0 (filepath-1.2.0.0-**f132e9f7703da4e20a47ff2b9acf1e** a1) (ghc-binary-0.5.0.2 (ghc-binary-0.5.0.2-**aba2b5dca5546ea1a972188de48f87**b5)) ghc-prim-0.2.0.0 (ghc-prim-0.2.0.0-**e1f7c380581d61d42b0360d440cc35** ed) haskell-src-1.0.1.4 (haskell-src-1.0.1.4-**7428a8c9049cd6bf5abdc0bbd2d417**c5) (haskell2010-1.0.0.0 (haskell2010-1.0.0.0-**53d9cd65595c551eea0c0269f534b5**e0)) haskell98-1.1.0.1 (haskell98-1.1.0.1-**35ec26bae828637c1638c8be441b3d **68) hpc-0.5.0.6 (hpc-0.5.0.6-**481dbb43fb624c21ad3bb9434675e3**ac) html-1.0.1.2 (html-1.0.1.2-**a494249f98a0f38b1a8db28bc70f8b**0b) integer-gmp-0.2.0.3 (integer-gmp-0.2.0.3-**91607778cf3ae8f3948a50062b4f84**79) mtl-2.0.1.0 (mtl-2.0.1.0-**fb4d1695269b74308c1517c06b76e6**e8) network-2.3.0.2 (network-2.3.0.2-**47657e39a6118a978d9f443d72e85d** 4a) old-locale-1.0.0.2 (old-locale-1.0.0.2-**6e2a3c0744e8cf4e0ac2d4e58659f7**b5) old-time-1.0.0.6 (old-time-1.0.0.6-**445ce39cbcebd38069c25c0f383b72** 8d) parallel-3.1.0.1 (parallel-3.1.0.1-**6eaa564e1ef1537bc88ad1fea6c90f** e2) parsec-3.1.1 (parsec-3.1.1-**9da59b00c02e52f9f62f3c87c7e0e2**ec) pretty-1.0.1.2 (pretty-1.0.1.2-**abc7c632374e50e1c1927987c2651f**0f) process-1.0.1.5 (process-1.0.1.5-**b3dded8e54a2e13d22af410bdcfaff** f4) random-1.0.0.3 (random-1.0.0.3-**1abde37180be5476311abeefe300ab**c2) regex-base-0.93.2 (regex-base-0.93.2-**9e1b027c41dbec856469a30982495b **b9) regex-compat-0.93.1 (regex-compat-0.93.1-**31c61fe0aee45e8a9853edf7a844f7**4e) regex-posix-0.94.4 (regex-posix-0.94.4-**f5eb628ea5dae5f91552d5ea0e2635**9d) rts-1.0 (builtin_rts) stm-2.2.0.1 (stm-2.2.0.1-**57e291244ee02349552a4f79caeb4f**fe) syb-0.3 (syb-0.3-**8db7bc4339a1cb8a6f2a46c40447ef**0b) text-0.11.0.6 (text-0.11.0.6-**398a3f02891247aea46662fc7379c4**a5) time-1.2.0.3 (time-1.2.0.3-**74ef6ac31cee9aec02b036978af002**d2) transformers-0.2.2.0 (transformers-0.2.2.0-**2fe7b735c63a6cbe8724038d8e4d81**2a) xhtml-3000.2.0.1 (xhtml-3000.2.0.1-**ace31b2e48c396e565655b0f34f5d2** b7)
Re: [Haskell-cafe] Dynamic loading of module
Anyway, I will reinstall Haskell platform and read carefully your post to be sure I do not screwed my setup again in the future. Best regards, Arnaud On Mon, Aug 29, 2011 at 8:41 AM, Arnaud Bailly arnaud.oq...@gmail.comwrote: Thanks again for your patience and efforts. I am pretty sure I did not remove anything from the global package scope, at least intentionally. But of course I may have done things whcih you did not recommend. Here is the command-line history: ghc-pgk unregister --user template-haskell ghc-pkg unregister --user template-haskell ghc-pkg unregister --force --user template-haskell ghc-pkg unregister --force --user quickcheck ghc-pkg unregister --force --user QuickCheck ghc-pkg unregister --force --user template-haskell cd C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\ dir c: dir cd package.conf.d dir cd .. rm -fr package.conf.d d: ghc-pkg check ghc-pkg update ghc-pkg recache Regards, Arnaud On Mon, Aug 29, 2011 at 4:03 AM, Albert Y. C. Lai tre...@vex.net wrote: On 11-08-28 04:40 PM, Arnaud Bailly wrote: Hello Albert, Thanks for taking the time to help me fix this package stuff. So I wiped out my package.conf.d/ and tried to reinstall my stuff. Installing template-haskell 2.5.0.0 is ok (2.6 is not, fails to compile on ghc 7.0.3) but then: D:\projets\ghc --make -package ghc main command line: cannot satisfy -package ghc (use -v for more information) I suspect I really *do* have to reinstall haskell-platform. Here is the output of ghc-pkg list -v: using cache: C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\**package.conf.d\package.cache using cache: D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d\package.cache D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d: Cabal-1.10.1.0 (Cabal-1.10.1.0-**55f781465ee9f32289755ad706c71f**0f) GLUT-2.1.2.1 (GLUT-2.1.2.1-**2d30997b9a19d27be388572e75af52**bf) HTTP-4000.1.1 (HTTP-4000.1.1-**267a332938fa742ba5a5d59de0b46d**60) HUnit-1.2.2.3 (HUnit-1.2.2.3-**102fbfbd594cd6d38461f5c68d8809**96) OpenGL-2.2.3.0 (OpenGL-2.2.3.0-**a58ce3ad6070e6b7932a3e779be57f**75) Win32-2.2.0.1 (Win32-2.2.0.1-**26cf39fdf591bdac61b11d5a443c62**ab) array-0.3.0.2 (array-0.3.0.2-**8e9cd0144e87fa9cc86cc9031631c4**f3) base-4.3.1.0 (base-4.3.1.0-**f520cd232cc386346843c4a12b63f4**4b) bin-package-db-0.0.0.0 (bin-package-db-0.0.0.0-**97d865e5935b41538bcb29fc1040ae**7d) bytestring-0.9.1.10 (bytestring-0.9.1.10-**cd85f14e02463c02ba4c77d7adcdb5**4f) cgi-3001.1.7.4 (cgi-3001.1.7.4-**659440ce11c2975fd9c9c471a1e8ff**3b) containers-0.4.0.0 (containers-0.4.0.0-**18deac99a132f04751d862b77aab13**6e) deepseq-1.1.0.2 (deepseq-1.1.0.2-**09b3aed0c4982bbc6569c668100876** fa) directory-1.1.0.0 (directory-1.1.0.0-** 3a2367d72569467a8af8a231656ff1**b8) extensible-exceptions-0.1.1.2 (extensible-exceptions-0.1.1.**2-**d8c5b906654260efd7249f497d17a8**31) ffi-1.0 (builtin_ffi) fgl-5.4.2.3 (fgl-5.4.2.3-**595811d6eabb1e1768685703ea66e9**82) filepath-1.2.0.0 (filepath-1.2.0.0-**f132e9f7703da4e20a47ff2b9acf1e* *a1) (ghc-binary-0.5.0.2 (ghc-binary-0.5.0.2-**aba2b5dca5546ea1a972188de48f87**b5)) ghc-prim-0.2.0.0 (ghc-prim-0.2.0.0-**e1f7c380581d61d42b0360d440cc35* *ed) haskell-src-1.0.1.4 (haskell-src-1.0.1.4-**7428a8c9049cd6bf5abdc0bbd2d417**c5) (haskell2010-1.0.0.0 (haskell2010-1.0.0.0-**53d9cd65595c551eea0c0269f534b5**e0)) haskell98-1.1.0.1 (haskell98-1.1.0.1-** 35ec26bae828637c1638c8be441b3d**68) hpc-0.5.0.6 (hpc-0.5.0.6-**481dbb43fb624c21ad3bb9434675e3**ac) html-1.0.1.2 (html-1.0.1.2-**a494249f98a0f38b1a8db28bc70f8b**0b) integer-gmp-0.2.0.3 (integer-gmp-0.2.0.3-**91607778cf3ae8f3948a50062b4f84**79) mtl-2.0.1.0 (mtl-2.0.1.0-**fb4d1695269b74308c1517c06b76e6**e8) network-2.3.0.2 (network-2.3.0.2-**47657e39a6118a978d9f443d72e85d** 4a) old-locale-1.0.0.2 (old-locale-1.0.0.2-**6e2a3c0744e8cf4e0ac2d4e58659f7**b5) old-time-1.0.0.6 (old-time-1.0.0.6-**445ce39cbcebd38069c25c0f383b72* *8d) parallel-3.1.0.1 (parallel-3.1.0.1-**6eaa564e1ef1537bc88ad1fea6c90f* *e2) parsec-3.1.1 (parsec-3.1.1-**9da59b00c02e52f9f62f3c87c7e0e2**ec) pretty-1.0.1.2 (pretty-1.0.1.2-**abc7c632374e50e1c1927987c2651f**0f) process-1.0.1.5 (process-1.0.1.5-**b3dded8e54a2e13d22af410bdcfaff** f4) random-1.0.0.3 (random-1.0.0.3-**1abde37180be5476311abeefe300ab**c2) regex-base-0.93.2 (regex-base-0.93.2-** 9e1b027c41dbec856469a30982495b**b9) regex-compat-0.93.1 (regex-compat-0.93.1-**31c61fe0aee45e8a9853edf7a844f7**4e) regex-posix-0.94.4 (regex-posix-0.94.4-**f5eb628ea5dae5f91552d5ea0e2635**9d) rts-1.0 (builtin_rts) stm-2.2.0.1 (stm-2.2.0.1-**57e291244ee02349552a4f79caeb4f**fe) syb-0.3 (syb-0.3-**8db7bc4339a1cb8a6f2a46c40447ef**0b) text-0.11.0.6
Re: [Haskell-cafe] bitSize
I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? I think that falls into the realm of protocol design; if you're doing it in your program at runtime, you're probably doing it wrong. (The fixed size version makes sense for marshaling; it's *dynamic* sizes that need to be thought out beforehand.) If you're doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 27 August 2011 21:57, Brandon Allbery allber...@gmail.com wrote: On Sat, Aug 27, 2011 at 06:57, Andrew Coppin andrewcop...@btinternet.comwrote: On 26/08/2011 10:51 PM, Steve Schafer wrote: On Fri, 26 Aug 2011 20:30:02 +0100, you wrote: You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? I can't say that I have cared about that sort of thing in a very long time. Bits are rather cheap these days. I store data on disk, and the space it occupies is whatever it is; I don't worry about it. I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? I think that falls into the realm of protocol design; if you're doing it in your program at runtime, you're probably doing it wrong. (The fixed size version makes sense for marshaling; it's *dynamic* sizes that need to be thought out beforehand.) All search engines deal with compressed integers, all compressors do, and most people doing bit-manipulation. Golomb, gamma, elias, rice coding, they all need this. Heck, even the Intel engineers chose to optimize this function by including the BSR instruction in the 386 architecture. This is a basic building block. Don't underestimate the bit, it is coming back with a vengeance. Bit-coding is everywhere now, because of the memory hierarchy. No haskeller should be left behind. Alexander ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Decompressing and http-enumerator
Hi all, Erik just opened an issue on Github[1] that affected me very recently as well when writing some automated Hackage checking code[2]. The issue is that http-enumerator sees the content-encoding header and decompresses the tarball, returning an uncompressed tarfile. I can avoid this with rawBody = False, but that's not a real solution, since that also disables chunked response handling. So one possible solution is to just add an option to never decompress response bodies, but that's a bit of a hack. The real question is: what's the correct way to handle these tarballs? Web browsers seem to know not to decompress them, but AFAICT http-enumerator is correctly following the spec by decompressing. Another possibility is to determine whether or not to decompress based on the content type, using either a white or black list (e.g., never compress TAR files, always decompress HTML files, etc). I'm open to suggestions here. Michael [1] https://github.com/snoyberg/http-enumerator/issues/30 [2] https://github.com/yesodweb/maintenance/blob/master/release/sdist-check.hs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 29/08/2011 09:00 AM, Brandon Allbery wrote: On Mon, Aug 29, 2011 at 03:40, Andrew Coppin andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com wrote: I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? I think that falls into the realm of protocol design; if you're doing it in your program at runtime, you're probably doing it wrong. (The fixed size version makes sense for marshaling; it's *dynamic* sizes that need to be thought out beforehand.) If you're doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common... Sure, and there are encodings that let you do this without needing bitSize (BER). You need a word count, but that's usually part of the structure holding the integer. OK. But since there's no way of getting a byte count for an Integer either... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Off-topic: Mathematics
This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? (Apart from go visit the nearest university, that is.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics
Possibly: http://math.stackexchange.com/ On 29 August 2011 10:34, Andrew Coppin andrewcop...@btinternet.com wrote: This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? (Apart from go visit the nearest university, that is.) ___ 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] Off-topic: Mathematics
The http://math.stackexchange.com/ for normal questions, http://mathoverflow.net/ for research level questions. Jack Henahan jhena...@uvm.edu == Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra == 398E692F.gpg Description: application/apple-msg-attachment On Aug 29, 2011, at 4:34 AM, Andrew Coppin wrote: This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? (Apart from go visit the nearest university, that is.) ___ 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] bitSize
On Mon, Aug 29, 2011 at 04:32, Andrew Coppin andrewcop...@btinternet.comwrote: OK. But since there's no way of getting a byte count for an Integer either... The count depends on how you're serializing it; unless you are literally serializing to individual bits and sending them over a synchronous serial link, the correct answer is an integer logarithm by your word size + the current definition of bitSize applied to said word. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On Mon, Aug 29, 2011 at 04:08, Alexander Kjeldaas alexander.kjeld...@gmail.com wrote: All search engines deal with compressed integers, all compressors do, and most people doing bit-manipulation. Golomb, gamma, elias, rice coding, they all need this. Heck, even the Intel engineers chose to optimize this function by including the BSR instruction in the 386 architecture. This is a basic building block. Don't underestimate the bit, it is coming back with a vengeance. Bit-coding is everywhere now, because of the memory hierarchy. No haskeller should be left behind. Is it so basic that we must throw out the current meaning of bitSize, with all *its* uses, to satisfy yours? -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Mon, Aug 29, 2011 at 04:08, Michael Snoyman mich...@snoyman.com wrote: So one possible solution is to just add an option to never decompress response bodies, but that's a bit of a hack. The real question is: what's the correct way to handle these tarballs? Web browsers seem to know not to decompress them, but AFAICT http-enumerator is correctly following the spec by decompressing. Another possibility is to Seem to is pretty much correct; it took years for some browsers to reliably handle them correctly. (Anyone else remember Mozilla saving compressed tarballs uncompressed?) -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unexpected Typeable behaviour; Prelude.undefined
Dear Brandon, Ozgur, et al, Thanks very much for you explanation. This seems to be a perfectly reasonable explanation; the wrapper-types I used probably explicitly invoke typeOf with undefined. The problem here, however, is that in my actual program, I don't use ADTs, but I use GADTs, so as to carry the context (Monad, Typeable1) with the constructor. To get to this context, I must pattern-match with the constructor. It seems hiding contexts (which I really like about GADTs) isn't available consistently. Oh well ;) Regards, Philip On 29 Aug 2011, at 01:20, Brandon Allbery wrote: On Sun, Aug 28, 2011 at 18:44, Philip Holzenspies p...@st-andrews.ac.ukmailto:p...@st-andrews.ac.uk wrote: instance (Typeable1 m, Monad m) = Typeable (MyADT m) where typeOf t@(MyADT _) typeOf is usually invoked with an undefined parameter; it should use types, never values. Here you've defined it to deconstruct what it's passed, which means that anything that uses it in the usual way (`typeOf (undefined :: someType)') will immediately throw undefined. You don't need a deconstructor there; you (correctly) throw away the value, and it doesn't provide any type information not already available from the instance declaration. `typeOf t' should be good enough. -- brandon s allbery allber...@gmail.commailto:allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic loading of module
After reinstalling HP 2011.2.0.1 and (re)wiping out user package directory, things are in better shape and I can now compile the faulty module. I am well aware I did something wrong at some point in time but I am not really sure of what happened. I suspect things went wrong when I tried to install a recent version of snap framework : I vaguely recall having to upgrade some core modules to make cabal happy which obviously was not a good thing. Maybe this already exists but it would good to have some session-like feature in cabal that would allow fiddling with the configuration and give the user the ability to rollback what she did. Not sure this would be to easy to implement though... Thanks again for your help. Best regards, Arnaud On Mon, Aug 29, 2011 at 8:43 AM, Arnaud Bailly arnaud.oq...@gmail.comwrote: Anyway, I will reinstall Haskell platform and read carefully your post to be sure I do not screwed my setup again in the future. Best regards, Arnaud On Mon, Aug 29, 2011 at 8:41 AM, Arnaud Bailly arnaud.oq...@gmail.comwrote: Thanks again for your patience and efforts. I am pretty sure I did not remove anything from the global package scope, at least intentionally. But of course I may have done things whcih you did not recommend. Here is the command-line history: ghc-pgk unregister --user template-haskell ghc-pkg unregister --user template-haskell ghc-pkg unregister --force --user template-haskell ghc-pkg unregister --force --user quickcheck ghc-pkg unregister --force --user QuickCheck ghc-pkg unregister --force --user template-haskell cd C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\ dir c: dir cd package.conf.d dir cd .. rm -fr package.conf.d d: ghc-pkg check ghc-pkg update ghc-pkg recache Regards, Arnaud On Mon, Aug 29, 2011 at 4:03 AM, Albert Y. C. Lai tre...@vex.net wrote: On 11-08-28 04:40 PM, Arnaud Bailly wrote: Hello Albert, Thanks for taking the time to help me fix this package stuff. So I wiped out my package.conf.d/ and tried to reinstall my stuff. Installing template-haskell 2.5.0.0 is ok (2.6 is not, fails to compile on ghc 7.0.3) but then: D:\projets\ghc --make -package ghc main command line: cannot satisfy -package ghc (use -v for more information) I suspect I really *do* have to reinstall haskell-platform. Here is the output of ghc-pkg list -v: using cache: C:\Documents and Settings\abailly\Application Data\ghc\i386-mingw32-7.0.3\**package.conf.d\package.cache using cache: D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d\package.cache D:/Program Files/Haskell Platform/2011.2.0.1\lib\**package.conf.d: Cabal-1.10.1.0 (Cabal-1.10.1.0-**55f781465ee9f32289755ad706c71f** 0f) GLUT-2.1.2.1 (GLUT-2.1.2.1-**2d30997b9a19d27be388572e75af52**bf) HTTP-4000.1.1 (HTTP-4000.1.1-**267a332938fa742ba5a5d59de0b46d**60) HUnit-1.2.2.3 (HUnit-1.2.2.3-**102fbfbd594cd6d38461f5c68d8809**96) OpenGL-2.2.3.0 (OpenGL-2.2.3.0-**a58ce3ad6070e6b7932a3e779be57f** 75) Win32-2.2.0.1 (Win32-2.2.0.1-**26cf39fdf591bdac61b11d5a443c62**ab) array-0.3.0.2 (array-0.3.0.2-**8e9cd0144e87fa9cc86cc9031631c4**f3) base-4.3.1.0 (base-4.3.1.0-**f520cd232cc386346843c4a12b63f4**4b) bin-package-db-0.0.0.0 (bin-package-db-0.0.0.0-**97d865e5935b41538bcb29fc1040ae**7d) bytestring-0.9.1.10 (bytestring-0.9.1.10-**cd85f14e02463c02ba4c77d7adcdb5**4f) cgi-3001.1.7.4 (cgi-3001.1.7.4-**659440ce11c2975fd9c9c471a1e8ff** 3b) containers-0.4.0.0 (containers-0.4.0.0-**18deac99a132f04751d862b77aab13**6e) deepseq-1.1.0.2 (deepseq-1.1.0.2-**09b3aed0c4982bbc6569c668100876** fa) directory-1.1.0.0 (directory-1.1.0.0-** 3a2367d72569467a8af8a231656ff1**b8) extensible-exceptions-0.1.1.2 (extensible-exceptions-0.1.1.**2-**d8c5b906654260efd7249f497d17a8**31) ffi-1.0 (builtin_ffi) fgl-5.4.2.3 (fgl-5.4.2.3-**595811d6eabb1e1768685703ea66e9**82) filepath-1.2.0.0 (filepath-1.2.0.0-**f132e9f7703da4e20a47ff2b9acf1e **a1) (ghc-binary-0.5.0.2 (ghc-binary-0.5.0.2-**aba2b5dca5546ea1a972188de48f87**b5)) ghc-prim-0.2.0.0 (ghc-prim-0.2.0.0-**e1f7c380581d61d42b0360d440cc35 **ed) haskell-src-1.0.1.4 (haskell-src-1.0.1.4-**7428a8c9049cd6bf5abdc0bbd2d417**c5) (haskell2010-1.0.0.0 (haskell2010-1.0.0.0-**53d9cd65595c551eea0c0269f534b5**e0)) haskell98-1.1.0.1 (haskell98-1.1.0.1-** 35ec26bae828637c1638c8be441b3d**68) hpc-0.5.0.6 (hpc-0.5.0.6-**481dbb43fb624c21ad3bb9434675e3**ac) html-1.0.1.2 (html-1.0.1.2-**a494249f98a0f38b1a8db28bc70f8b**0b) integer-gmp-0.2.0.3 (integer-gmp-0.2.0.3-**91607778cf3ae8f3948a50062b4f84**79) mtl-2.0.1.0 (mtl-2.0.1.0-**fb4d1695269b74308c1517c06b76e6**e8) network-2.3.0.2 (network-2.3.0.2-**47657e39a6118a978d9f443d72e85d** 4a) old-locale-1.0.0.2 (old-locale-1.0.0.2-**6e2a3c0744e8cf4e0ac2d4e58659f7**b5) old-time-1.0.0.6 (old-time-1.0.0.6-**445ce39cbcebd38069c25c0f383b72 **8d)
Re: [Haskell-cafe] Decompressing and http-enumerator
Brandon Allbery wrote: On Mon, Aug 29, 2011 at 04:08, Michael Snoyman mich...@snoyman.com wrote: So one possible solution is to just add an option to never decompress response bodies, but that's a bit of a hack. The real question is: what's the correct way to handle these tarballs? Web browsers seem to know not to decompress them, but AFAICT http-enumerator is correctly following the spec by decompressing. Another possibility is to Seem to is pretty much correct; it took years for some browsers to reliably handle them correctly. (Anyone else remember Mozilla saving compressed tarballs uncompressed?) Yes, it was a pain in the neck. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On Fri, 2011-08-26 at 20:30 +0100, Andrew Coppin wrote: On 26/08/2011 07:36 PM, Steve Schafer wrote: On Fri, 26 Aug 2011 18:24:37 +0100, you wrote: I would usually want #3 or #4. Out of curiosity, what for? While I do occasionally need to get a logarithmic size estimate of a number (which is basically what #3 and #4 are), the specific requirements in each case tend to vary, enough so that it's unlikely that a single function (other than simply taking the logarithm) can handle the majority of applications. You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? Or how many bits of randomness you need to compute a value less than or equal to this one? I suppose I could use a binary logarithm. I'm just concerned that it would be rather slow. After all, I'm not interested in the exact logarithm (which is fractional), just the number of bits (which is a small integer)... According to random side (http://gruntthepeon.free.fr/ssemath/) not so new computers can compute 15.5 milions of serial logarithms per second (62 millions in total). I'd say that overhead of Integer might be much bigger then cost of logarithm. Best regards signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On Monday 29 August 2011, 12:32:51, Maciej Marcin Piechotka wrote: On Fri, 2011-08-26 at 20:30 +0100, Andrew Coppin wrote: I suppose I could use a binary logarithm. I'm just concerned that it would be rather slow. After all, I'm not interested in the exact logarithm (which is fractional), just the number of bits (which is a small integer)... According to random side (http://gruntthepeon.free.fr/ssemath/) not so new computers can compute 15.5 milions of serial logarithms per second (62 millions in total). I'd say that overhead of Integer might be much bigger then cost of logarithm. Well, converting the Integer to Double can easily take longer than calculating the logarithm. The main problem with this approach, however, is that only smallish (cryptographically speaking) Integers can be converted to Double with something resembling adequate precision (above 2^1024-2^972, you'll get Infinity from the conversion, log is Infinity: boom). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Mon, Aug 29, 2011 at 10:08 AM, Michael Snoyman mich...@snoyman.com wrote: Hi all, Erik just opened an issue on Github[1] that affected me very recently as well when writing some automated Hackage checking code[2]. The issue is that http-enumerator sees the content-encoding header and decompresses the tarball, returning an uncompressed tarfile. I can avoid this with rawBody = False, but that's not a real solution, since that also disables chunked response handling. A web server should not be setting Content-encoding: gzip on a .tar.gz file. I agree that http-enumerator is correctly following the spec by decompressing. If you decide to implement a workaround for this, the only reasonable thing I can think of is adding a ignoreContentEncoding knob the user can twiddle to violate spec. G -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems creating Haskell-dll without -fvia-C
Hi! I recently read a haskell-cafe-thread telling me that the compiler option -fvia-C will be removed. This gets me a bit worried... I use -fvia-C when I build my haskell dll, and it works just fine (Haskell 2010.2.0.0): ghc -c Adder.hs -O2 -fvia-C ghc -c StartEnd.c ghc -shared -o Adder.dll Adder.o Adder_stub.o StartEnd.o Adder.def Next I create a lib which can be imported in Visual C++: lib /machine:i386 /def:SingThing.def BUT...if I remove the flag -fvia-C, the program crashes when I run it:( I've tried experimenting with a few things: * Haskell FFI's calling conventions ccall/stdcall * Skipping the .def file * Skipping lib /machine:i386 /def:SingThing.def, instead trying the approach descibed in: http://blogs.msdn.com/b/satnam_singh/archive/2011/04/19/creating-a-windows-dll-from-a-haskell-program-and-calling-it-from-c.aspx Can anyone please give me a hint of whats going on? I guess it must be somthing with pointers and calling conventions, but I'm banging my head against the wall now:( Cheers Klas (Btw... I should mention that the simple Adder.hs example actually works without -fvia-C, my dll is more advanced, but I'm following the same compiling procedure) -- View this message in context: http://haskell.1045720.n5.nabble.com/Problems-creating-Haskell-dll-without-fvia-C-tp4745874p4745874.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics
On 29 August 2011 09:34, Andrew Coppin andrewcop...@btinternet.com wrote: This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? Apart from math.stackexchange.com and mathoverflow.net, which people have already mentioned, people often discuss mathematics on #haskell-blah on Freenode. Benedict ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics
There's also #math on freenode, but it's a scary wilderness. On 29 August 2011 13:34, Benedict Eastaugh ionf...@gmail.com wrote: On 29 August 2011 09:34, Andrew Coppin andrewcop...@btinternet.com wrote: This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? Apart from math.stackexchange.com and mathoverflow.net, which people have already mentioned, people often discuss mathematics on #haskell-blah on Freenode. Benedict ___ 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] Decompressing and http-enumerator
On Mon, Aug 29, 2011 at 2:21 PM, Gregory Collins g...@gregorycollins.net wrote: On Mon, Aug 29, 2011 at 10:08 AM, Michael Snoyman mich...@snoyman.com wrote: Hi all, Erik just opened an issue on Github[1] that affected me very recently as well when writing some automated Hackage checking code[2]. The issue is that http-enumerator sees the content-encoding header and decompresses the tarball, returning an uncompressed tarfile. I can avoid this with rawBody = False, but that's not a real solution, since that also disables chunked response handling. A web server should not be setting Content-encoding: gzip on a .tar.gz file. I agree that http-enumerator is correctly following the spec by decompressing. If you decide to implement a workaround for this, the only reasonable thing I can think of is adding a ignoreContentEncoding knob the user can twiddle to violate spec. I'm wondering what the most appropriate way to handle this is. Maybe a dontDecompress record, looking like: type ContentType = ByteString dontDecompress :: ContentType - Bool Then browser behavior would be: browserDecompress = (== application/x-tar) and current behavior would be: defaultDecompress = const False I don't have any strong opinions here... Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On Mon, 29 Aug 2011 08:40:45 +0100, you wrote: If you're doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common... This is the part that makes no sense to me. Yes, you are absolutely correct that large, multiple-byte integers play a big role in cryptography. But those are invariably FIXED LENGTH multiple-byte integers. As I mentioned before, to the best of my knowledge, no one uses variable-size representations in those kinds of computationally-intensive applications. -Steve Schafer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Mon, 2011-08-29 at 13:21 +0200, Gregory Collins wrote: A web server should not be setting Content-encoding: gzip on a .tar.gz file. Why not? From RFC2616 compliant servers I'd expect a .tar.gz file to have the Content-* headers provide meta-information about the content[1], e.g. Content-Type: application/x-tar Content-Encoding: gzip Transfer-Encoding: chunked If I want to detach the gzip encoding from the content (or entity), I'd move it to the Transfer-Encoding header[2], e.g.: Content-Type: application/x-tar Transfer-Encoding: gzip, chunked [1]: See RFC2616 sec7.2.1: Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. [2]: See RFC2616 sec4.3: Transfer-Encoding is a property of the message, not of the entity, and thus MAY be added or removed by any application along the request/response chain. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
Now, something really à côté de la plaque... Jack Henahan terminates his useful advice addressed to A. Coppin: Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra This citation makes me think, and since this became rare, I share it. * It is unsourced, repeated without discernment, and Dijkstra cannot confirm (or deny) it any more. Somehow I cannot believe he said that... * Dijkstra began to study physics, and a physicist would be reluctant to make such puns. Why? o Astronomy, and physics are not only theories of galaxies or superfluids, but also methodologies of data acquisition and data processing. Telescopes evolve with our knowledge of the visible universe, as the accelerators evolve with our knowledge of elementary particles. You have to know where to look! And how to interpret the raw, experimental data. o So, whether you call it Informatique, Datalogi, or whatever, it is */also/* about computers. Do you really think that the algorithmics, the thory of parallel computation, etc., have nothing to do with concrete implementations? * These among you who touched just a bit of astronomy, should know what a horrendous amount of truly astronomical knowledge is necessary to make the telescope work! For example to synchronize it with the earth movement... * This citation seems to be a savant variant of: The Fool Looks At The Finger That Points To The Sky case... OK, if you wish. But I had an occasion to sit near a beautiful girl who pointed her hand and her eyes in the direction of wonderful Zodiac constellations; it was midnight in the mountains. I don't remember the details, but without being a fool, I didn't look at the stars... (Well, actually I was a fool, but it is a long story). Jerzy Karczmarczuk Caen, France ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
Wherever its origin, it is featured in SICP which was out in 1984: http://www.youtube.com/watch?v=zQLUPjefuWA It's a sound analogy. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic loading of module
On 11-08-29 02:41 AM, Arnaud Bailly wrote: ghc-pkg unregister --force --user template-haskell [...] ghc-pkg unregister --force --user template-haskell I am sorry. I apologize. It was not your fault. It was my fault. unregister --user drops the global instance when there is no user instance, which is when the 2nd time you issued the command. It is a ghc-pkg bug. (I already knew the dual bug: unregister --global drops the user instance when there is one. I make do with unregister --global --no-user-package-conf.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dynamic loading of module
No offense :-) Thanks for taking the time to investigate this stuff. It gave me the opportunity to get a closer look at ghc package management. Regards, Arnaud On Mon, Aug 29, 2011 at 5:28 PM, Albert Y. C. Lai tre...@vex.net wrote: On 11-08-29 02:41 AM, Arnaud Bailly wrote: ghc-pkg unregister --force --user template-haskell [...] ghc-pkg unregister --force --user template-haskell I am sorry. I apologize. It was not your fault. It was my fault. unregister --user drops the global instance when there is no user instance, which is when the 2nd time you issued the command. It is a ghc-pkg bug. (I already knew the dual bug: unregister --global drops the user instance when there is one. I make do with unregister --global --no-user-package-conf.) __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] Decompressing and http-enumerator
On Mon, Aug 29, 2011 at 5:28 PM, Herbert Valerio Riedel h...@gnu.org wrote: On Mon, 2011-08-29 at 13:21 +0200, Gregory Collins wrote: A web server should not be setting Content-encoding: gzip on a .tar.gz file. Why not? From RFC2616 compliant servers I'd expect a .tar.gz file to have the Content-* headers provide meta-information about the content[1], e.g. Content-Type: application/x-tar Content-Encoding: gzip Transfer-Encoding: chunked If I want to detach the gzip encoding from the content (or entity), I'd move it to the Transfer-Encoding header[2], e.g.: Content-Type: application/x-tar Transfer-Encoding: gzip, chunked [1]: See RFC2616 sec7.2.1: Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. [2]: See RFC2616 sec4.3: Transfer-Encoding is a property of the message, not of the entity, and thus MAY be added or removed by any application along the request/response chain. chunked is the only valid transfer-encoding[1], while gzip must be specified on the content-encoding header[2]. For a simple example of these two, look at the response headers from Haskellers[3] in something like Chrome developer tools. [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6 [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5 [3] http://www.haskellers.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
On Mon, Aug 29, 2011 at 11:19 AM, Jerzy Karczmarczuk jerzy.karczmarc...@unicaen.fr wrote: It is unsourced, repeated without discernment, and Dijkstra cannot confirm (or deny) it any more. Somehow I cannot believe he said that... Dijkstra began to study physics, and a physicist would be reluctant to make such puns. Why? Some googling takes me to the full quote: Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes, or chemistry is about beakers and test tubes. Science is not about tools. It is about how we use them, and what we find out when we do. Which is referenced to, inside _Invitation to Computer Science_ (G. Michael Schneider, Judith L. Gersting, Keith Miller; http://books.google.com/books?id=gQK0pJONyhgC ), to Fellows, M.R., and Parberry, I. Getting Children Excited About Computer Science, _Computing Research News_, vol. 5, no. 1 (January 1993). Curiously, the preface to the quote is: This distinction between computers and computer science is beautifully expressed by computer scientists Michael R. Fellows and Ian Parberry in an article in the journal _Computing Research News_: *No* mention of Dijkstra. Searching that full book, the only Dijkstra mentions are unconnected to the quote. Chasing links, I head to http://archive.cra.org/CRN/issues/by_title_by_issue.html and download January 1993: http://archive.cra.org/CRN/issues/9301.pdf On page 7, I find it. The article title is different: SIGACT trying to get children excited about CS. The money line is highlighted. The relevant paragraph and surrounding paragraphs: Is it any wonder then that computer science is represented in many schools by either computer games or some antiquated approach to programming, which at worst concentrates on a litany of syntax and at best emphasizes expediency over effectiveness and efficiency? But computer science is not about computers—it is about computation. What would we like our children- the general public of the future—to learn about computer science in schools? We need to do away with the myth that computer science is about computers. Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes or chemistry is about beakers and test tubes. Science is not about tools, it is about how we use them and what we find out when we do. It may come as a surprise to some that computer science is full of activities that children still find exciting even without the use of computers. Take theoretical computer science, for example, which may seem an unlikely candidate. If computer science is underrepresented in schools, then theoretical computer science is doubly so. This is the precise quote, with no quotation marks or references or allusions of any kind; this seems to be the original, where the exact quote comes from. There are no mentions whatsoever of Dijkstra in the January PDF. On Mon, Aug 29, 2011 at 11:25 AM, Christopher Done chrisd...@googlemail.com wrote: Wherever its origin, it is featured in SICP which was out in 1984: http://www.youtube.com/watch?v=zQLUPjefuWA It's a sound analogy. Abelson doesn't cite Dijkstra in the first minute where he makes the comparisons, either, unless I missed it. As well, in no Google hit did I find any specific citation to Dijkstra. Hence, I conclude that because it is insightful and sounds like Dijkstra (eg. his submarine quote), it has become apocryphally associated with him but is *not* actually a Dijkstra quote. -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
Better? Jack Henahan jhena...@uvm.edu == Computer science is no more about computers than astronomy is about telescopes…. -- Michael R. Fellows and Ian Parberry == 398E692F.gpg Description: application/apple-msg-attachment On Aug 29, 2011, at 11:47 AM, Gwern Branwen wrote: Michael R. Fellows and Ian Parberry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Text.Parsec.Prim
Hi, I seem to have some trouble accessing this module. I would like to use the type synonym ParsecT directly. I'm running GHC 6.12.1. According to Hoogle, the type I want is part of parsec-3.1.1, in module Text.Parsec.Prim. But if try to import Text.Parsec.Prim, GHC complains Could not find module `Text.Parsec.Prim': Can anyone help me with this? In the 2+ years I've been using parsec I've never managed to use ParsecT directly, but now it would be very useful. thanks, Roly In verbose mode, GHC reports: Glasgow Haskell Compiler, Version 6.12.1, for Haskell 98, stage 2 booted by GHC version 6.12.1 Using binary package database: /usr/lib/ghc-6.12.1/package.conf.d/package.cache Using binary package database: /home/rolyp/.ghc/x86_64-linux-6.12.1/package.conf.d/package.cache hiding package Cabal-1.8.0.2 to avoid conflict with later version Cabal-1.10.2.0 hiding package QuickCheck-1.2.0.0 to avoid conflict with later version QuickCheck-2.1.0.2 hiding package base-3.0.3.2 to avoid conflict with later version base-4.2.0.0 wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-9d35c97e886f807a1e6d024aaa91dcec wired-in package integer-gmp mapped to integer-gmp-0.2.0.0-9a51ffb34a83618a1a3d4e472b9977a0 wired-in package base mapped to base-4.2.0.0-2cc27b7e43511c4ca001642a7f77a8f6 wired-in package rts mapped to builtin_rts wired-in package haskell98 mapped to haskell98-1.0.1.1-0fdaf3b26bc38c43ce8371edf538dbf6 wired-in package template-haskell mapped to template-haskell-2.4.0.0-bbc7c61990d2fe9d20be2deb924f833c wired-in package dph-seq mapped to dph-seq-0.4.0-52cfd6db5fc09a2abf793cd6a856a392 wired-in package dph-par mapped to dph-par-0.4.0-b4f339fed900d7bc4b3db61526caf863 Hsc static flags: -static ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
In fairness, I already knew it wasn't an actual Dijkstra quote. It's just one that gets thrown around with his name on it. The origins were misty enough that I just decided to pick the one that pop culture chose. Jack Henahan jhena...@uvm.edu == Computer science is no more about computers than astronomy is about telescopes…. -- Michael R. Fellows and Ian Parberry == 398E692F.gpg Description: application/apple-msg-attachment On Aug 29, 2011, at 12:08 PM, Jack Henahan wrote: Better? Jack Henahan jhena...@uvm.edu == Computer science is no more about computers than astronomy is about telescopes…. -- Michael R. Fellows and Ian Parberry == 398E692F.gpg On Aug 29, 2011, at 11:47 AM, Gwern Branwen wrote: Michael R. Fellows and Ian Parberry ___ 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] Truly Really Off-topic: (Was: Mathematics)
I'm afraid you're going to have a lot of OCD's completely miss the point of your email and annoy you with comments about the quote which you'll then have to refute. I'd actually stick with the old comment, remove it completely, include a short summary with a link to the paper or attribute it to Abe Lincoln. -deech On Mon, Aug 29, 2011 at 11:08 AM, Jack Henahan jhena...@uvm.edu wrote: Better? Jack Henahan jhena...@uvm.edu == Computer science is no more about computers than astronomy is about telescopes…. -- Michael R. Fellows and Ian Parberry == On Aug 29, 2011, at 11:47 AM, Gwern Branwen wrote: Michael R. Fellows and Ian Parberry ___ 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] Text.Parsec.Prim
On Mon, Aug 29, 2011 at 11:12 AM, Roly Perera roly.per...@dynamicaspects.org wrote: Hi, I seem to have some trouble accessing this module. I would like to use the type synonym ParsecT directly. I'm running GHC 6.12.1. According to Hoogle, the type I want is part of parsec-3.1.1, in module Text.Parsec.Prim. But if try to import Text.Parsec.Prim, GHC complains Could not find module `Text.Parsec.Prim': Can anyone help me with this? In the 2+ years I've been using parsec I've never managed to use ParsecT directly, but now it would be very useful. There might be something off about your packages database. I just did: $ cabal update $ cabal install parsec $ ghci import Text.Parsec.Prim and it went fine. Also, the module Text.Parsec re-exports the entirety of Text.Parsec.Prim, so you won't get much advantage importing the Prim module on its own. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Mon, Aug 29, 2011 at 4:28 PM, Herbert Valerio Riedel h...@gnu.org wrote: On Mon, 2011-08-29 at 13:21 +0200, Gregory Collins wrote: A web server should not be setting Content-encoding: gzip on a .tar.gz file. Why not? From RFC2616 compliant servers I'd expect a .tar.gz file to have the Content-* headers provide meta-information about the content[1], e.g. Content-Type: application/x-tar Content-Encoding: gzip Transfer-Encoding: chunked The way I would interpret this is: this MIME body is a TAR file which has been gzip-encoded for the purpose of efficiency in transmission. When I ask the library for the body contents as an octet stream, I would expect to get the TAR file contents, uncompressed. This is how it works when you send text/html with Content-Encoding: gzip, I don't understand why it should be different with a .tar.gz file. If you wanted the MIME body to be passed through unmolested (i.e. you expect the octet stream to actually be in gzip-compressed TAR format), I would expect that you set Content-Type: application/x-tgz without a Content-Encoding. But that's just my interpretation both of standard practice and of the spec. If I want to detach the gzip encoding from the content (or entity), I'd move it to the Transfer-Encoding header[2], e.g.: Content-Type: application/x-tar Transfer-Encoding: gzip, chunked As Michael mentioned, that isn't how those headers are interpreted. G -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Text.Parsec.Prim
Cool. I assumed that since I already had Parsec installed as part of the Haskell Platform it wouldn't have made any difference, but actually it sorted it. Thanks a lot! On 29 August 2011 18:25, Antoine Latter aslat...@gmail.com wrote: There might be something off about your packages database. I just did: $ cabal update $ cabal install parsec $ ghci import Text.Parsec.Prim and it went fine. Also, the module Text.Parsec re-exports the entirety of Text.Parsec.Prim, so you won't get much advantage importing the Prim module on its own. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
On Mon, Aug 29, 2011 at 12:18 PM, aditya siram aditya.si...@gmail.com wrote: I'm afraid you're going to have a lot of OCD's completely miss the point of your email and annoy you with comments about the quote which you'll then have to refute. I dunno, I found the quote interesting. I had typed up a scornful response to the effect that everyone knows it's a Dijkstra quote and he could find sourcing in seconds with Google, but as the seconds passed, I had to rewrite the seconds bit, then as I found actual cites, I had to rewrite the Dijkstra bit, and then I realized that replying to that email might take a while... -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Truly Really Off-topic: (Was: Mathematics)
On Mon, Aug 29, 2011 at 11:47 AM, Gwern Branwen gwe...@gmail.com wrote: As well, in no Google hit did I find any specific citation to Dijkstra. Hence, I conclude that because it is insightful and sounds like Dijkstra (eg. his submarine quote), it has become apocryphally associated with him but is *not* actually a Dijkstra quote. To follow up: - 'telescopes' does not appear anywhere in the EWDs: http://ewd.cs.utexas.edu.master.com/texis/master/search/?sufs=0q=telescopesxsubmit=Searchs=SS - Ruud Koot points to an August* 1993 PhD thesis (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.8045rep=rep1type=pdf) which attributes it, with no citation or sourcing information, to Dijkstra - a Redditor claims, with no citation or sourcing information, that it was Marvin Minsky (http://www.reddit.com/r/programming/comments/jy1zw/psa_dijkstra_did_not_say_computer_science_is_no/c2g17xt) * that is, well after the original January 1993 article -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Trouble with Haddock
On Sun, Aug 28, 2011 at 6:37 AM, anonymous qubi...@gmail.com wrote: First time using haddock. I'm unable to include code examples in the module header. Haddock fails with this error: haddock module header parse failed: Cannot parse header documentation paragraphs It's about 12 lines of code, which doesn't seem like much compared to other packages. e.g. -- | describing module -- -- code -- ... -- code module Foo ( I tried @...@ code blocks, but that didn't work either. If I shorten the code to 3 lines or so, it will work. You'll probably get better help if you include the failing example. Just speaking for myself, I can't spot the problem from the example you've included. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC API question
On 11-08-28 11:38 AM, Chris Smith wrote: Okay, I should have waited until morning to post this... so actually, things still work fine when I build without profiling. However, when I build with profiling, I get the segfault. I'm guessing either I need to set different dynamic flags with the profiling build to match the options of the compiler that built the executable... or perhaps it's still impossible to do what I'm looking for with profiling enabled. Does anyone know which is the case? Inspired by thees facts: A. all other aspects of GHC are so keen on never mixing profiling-built code with non-profiling-built code B. GHC API loads modules from disk, regardless of whether the same module is already part of the executable. And then, stuff from loaded modules is expected to be compatible with stuff from the executable, e.g., x - unsafeCoerce `liftM` getHValue blah blah print x x is from loaded code, print is from executable code, we mix them. (After all, presumably the executable got its code from the same origin.) I hypothesize that your program is made to mix profiling-built code (in the executable, such as print) with non-profiling-built code (in loaded modules, such as x). They probably don't mix well. I don't know how to convince GHC API to load modules from profiling libraries. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Aug 29, 2011 9:39 PM, Michael Snoyman mich...@snoyman.com wrote: On Mon, Aug 29, 2011 at 2:21 PM, Gregory Collins g...@gregorycollins.net wrote: On Mon, Aug 29, 2011 at 10:08 AM, Michael Snoyman mich...@snoyman.com wrote: Hi all, Erik just opened an issue on Github[1] that affected me very recently as well when writing some automated Hackage checking code[2]. The issue is that http-enumerator sees the content-encoding header and decompresses the tarball, returning an uncompressed tarfile. I can avoid this with rawBody = False, but that's not a real solution, since that also disables chunked response handling. A web server should not be setting Content-encoding: gzip on a .tar.gz file. I agree that http-enumerator is correctly following the spec by decompressing. If you decide to implement a workaround for this, the only reasonable thing I can think of is adding a ignoreContentEncoding knob the user can twiddle to violate spec. I'm wondering what the most appropriate way to handle this is. Maybe a dontDecompress record, looking like: type ContentType = ByteString dontDecompress :: ContentType - Bool Then browser behavior would be: browserDecompress = (== application/x-tar) and current behavior would be: defaultDecompress = const False I don't have any strong opinions here... I agree with Gregory's suggestion of an API that allows an application to see the data prior to decoding the Content-Encoding. It could be tagged with the name of the content-coding, and there could be a generic decode function (ie. the library already knows what needs to be done to decode, so there's no need for the application to go looking up the decode function by name). Conrad. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC API question
OK, I guess I misunderstood you. I don't know how SafeHaskell works, so I don't know whether there might be some interaction. I know that profiling is a static flag which must be set when you initialise the session and cannot be changed afterwards. I assume you are doing that. I checked the source code for getHValue (in 7.0.4) and it calls linkDependencies if the name is external (not 100 percent sure what that means). There is an interesting comment in linkDependencies, though: -- The interpreter and dynamic linker can only handle object code built -- the normal way, i.e. no non-std ways like profiling or ticky-ticky. -- So here we check the build tag: if we're building a non-standard way -- then we need to find link object files built the normal way. This is what I've was referring to in my previous mail. Even though you're compiling to machine code, you are using the in-memory linker (i.e., the GHCi linker). It seems like that this is a fundamental limitation of the internal linker. You may be using it in a way that doesn't trigger the sanity check and end up causing a panic. I suggest you pose this question on the glasgow-haskell-users mailing list. On 28 August 2011 17:57, Chris Smith cdsm...@gmail.com wrote: On Sun, 2011-08-28 at 17:47 +0100, Thomas Schilling wrote: I don't think you can link GHCi with binaries compiled in profiling mode. You'll have to build an executable. Okay... sorry to be obtuse, but what exactly does this mean? I'm not using GHCi at all: I *am* in an executable built with profiling info. I'm doing this: dflags - GHC.getSessionDynFlags let dflags' = dflags { GHC.ghcMode = GHC.CompManager, GHC.ghcLink = GHC.LinkInMemory, GHC.hscTarget = GHC.HscAsm, GHC.optLevel = 2, GHC.safeHaskell = GHC.Sf_Safe, GHC.packageFlags = [GHC.TrustPackage gloss ], GHC.log_action = addErrorTo codeErrors } GHC.setSessionDynFlags dflags' target - GHC.guessTarget filename Nothing GHC.setTargets [target] r - fmap GHC.succeeded (GHC.load GHC.LoadAllTargets) and then if r is true: mods - GHC.getModuleGraph let mainMod = GHC.ms_mod (head mods) Just mi - GHC.getModuleInfo mainMod let tyThings = GHC.modInfoTyThings mi let var = chooseTopLevel varname tyThings session - GHC.getSession v - GHC.liftIO $ GHC.getHValue session (GHC.varName var) return (unsafeCoerce# v) Here, I know that chooseTopLevel is working, but the getHValue part only works without profiling. So is this still hopeless, or do I just need to find the right additional flags to add to dflags'? -- Chris Smith -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 29/08/2011, at 10:32 PM, Maciej Marcin Piechotka wrote: According to random side (http://gruntthepeon.free.fr/ssemath/) not so new computers can compute 15.5 milions of serial logarithms per second (62 millions in total). I'd say that overhead of Integer might be much bigger then cost of logarithm. That's floating-point logarithms, not Integer logarithms. Single-precision floats, at that. The code in question does not link at optimisation level 4. At least some of the benchmark results are impossible to believe: benching cephes_sinf .. - 12762.3 millions of vector evaluations/second - 0 cycles/value on a 2000MHz computer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [xmonad] Cabal install problem
On Tue, Aug 30, 2011 at 12:30:08AM +0300, Tayfur Yilmaz wrote: Quoting Tayfur Yilmaz yilmaz.tay...@gmail.com: Hi everyone I have some problem for install 'cabal-install package' I downloaded and succesfully build a binary source ghc-7.0.2. Then I want to install cabal-0.10.2 and ? see some warning and last output like this Linking Setup ... Configuring Cabal-1.10.1.0... Setup: At least the following dependencies are missing: base =4 3 =2 5, unix =2.0 2.5 Error during cabal-install bootstrap: Configuring the Cabal package failed Then ? want to use cabal-0.8 and output like this Linking Setup ... Configuring Cabal-1.8.0.2... Setup: At least the following dependencies are missing: base =4 3 =1 5, filepath =1 1.2, unix =2.1 2.5 Error during cabal-install bootstrap: Configuring the Cabal package failed So Which compatible versiyon for cabal-install version I use Kde4 on Pardushttp://www.pardus.org.tr/ Best Regards Can someone describe install packages sort list.. I read some document and 1.Firstly ı download a binary version of Ghc (version 7.0.2) (bootstrap.py) bootstrap.py? There should not be any python scripts involved in installing a binary version of GHC. Where did you download it from? After installing it, does it work? If you type ghci at a command prompt, what happens? -Brent 2. cabal-install package download and install bu I send this bug And now I want to build hackage platform Command $ sudo ./configure Output ** * * Haskell Platform Source Installer * * For the Haskell Platform 2011.2.0.1 and GHC 7.0.3 * ** checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu *checking for ghc... notfound* configure: error: This installer for the Haskell Platform requires ghc to be installed first * If ghc is installed not on the PATH then use --with-ghc= and --with-ghc-pkg=* Command $ sudo ./configure --with-ghc= --with-ghc-pkg= Output ** * * Haskell Platform Source Installer * * For the Haskell Platform 2011.2.0.1 and GHC 7.0.3 * ** checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu *checking for hsc2hs... notfound* configure: error: The hsc2hs program could not be found. It is usually installed along with ghc. You may need to specify --with-hsc2hs= Command sudo ./configure --with-ghc= --with-ghc-pkg= --with-hsc2hs= Output ** * * Haskell Platform Source Installer * * For the Haskell Platform 2011.2.0.1 and GHC 7.0.3 * ** checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking version of ghc... *configure: error: does not seem to work (or maybe it is not actually ghc). * I build ghc binary and why I can't solve this problems. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Pointed, but not Applicative
On Sun, Aug 28, 2011 at 8:24 PM, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: f `fmap` FList g = _|_ f `fmap` FList g = map id f `fmap` FList g = map _|_ (+ variation of _|_*) f `fmap` FList g = \bs - map f (g []) ++ bs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
Michael Snoyman wrote: I'm wondering what the most appropriate way to handle this is. Just to get my thoughts in order I'll back track a little. In the HTTP repsonse, we have two header fields, content-type and content-encoding. For the later (which may be absent) we can have encodings of gzip or chunked (possibly others). Some examples: content-type content-encoding current practice === text/html gzip gunzip it in H.E. text/html chunkedunchunk it in H.E. For the case where H.E might be used as part of a HTTP proxy we also have a rawBody option that disables both the unchunking and the gunzipping. This rawBody functionality works now; I'm using it. We now add to the above a file type where the content-type is application/x-tar and the content-encoding is gzipped but from the filename part of the URL, a user may well expect that we get a tar.gz file but where H.E. currently gunzips it on the fly. So, on to your suggestion: Maybe a dontDecompress record, looking like: type ContentType = ByteString dontDecompress :: ContentType - Bool Then browser behavior would be: browserDecompress = (== application/x-tar) and current behavior would be: defaultDecompress = const False I think we should invert the logic of this (to avoid double negatives) so we have: type ContentType = ByteString decompress :: ContentType - Bool browserDecompress = (/== application/x-tar) defaultDecompress = const True Was the idea that this decompress field then gets added to the Request record? If so, would simpleHttp be modified to be: simpleHttp :: String - (ContentType - Bool) - m L.ByteString and exporting both browserDecompress and defaultDecompress so they can be used as two sane defaults for the second parameter? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [xmonad] Cabal install problem
I am also interested in the complete output of ghc -v and ghc-pkg list -v. Meanwhile, the pros may notice that Configuring Cabal-1.10.1.0... is very suspicious because GHC 7.0.2 comes with exactly Cabal-1.10.1.0, so there is no normal reason why it is being re-installed (cabal-install's bootstrap.sh certainly detects that, and I have just tested it); and immediately next Setup: At least the following dependencies are missing: base=4 3 =2 5, unix=2.0 2.5 base = 4 3 is very very ill, usually a sign of a very messed up collection of packages. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
On Tue, Aug 30, 2011 at 6:27 AM, Erik de Castro Lopo mle...@mega-nerd.com wrote: Michael Snoyman wrote: I'm wondering what the most appropriate way to handle this is. Just to get my thoughts in order I'll back track a little. In the HTTP repsonse, we have two header fields, content-type and content-encoding. For the later (which may be absent) we can have encodings of gzip or chunked (possibly others). Actually, chunked would go under transfer-encoding, but I think that's irrelevant for the rest of this discussion. Some examples: content-type content-encoding current practice === text/html gzip gunzip it in H.E. text/html chunked unchunk it in H.E. For the case where H.E might be used as part of a HTTP proxy we also have a rawBody option that disables both the unchunking and the gunzipping. This rawBody functionality works now; I'm using it. We now add to the above a file type where the content-type is application/x-tar and the content-encoding is gzipped but from the filename part of the URL, a user may well expect that we get a tar.gz file but where H.E. currently gunzips it on the fly. So, on to your suggestion: Maybe a dontDecompress record, looking like: type ContentType = ByteString dontDecompress :: ContentType - Bool Then browser behavior would be: browserDecompress = (== application/x-tar) and current behavior would be: defaultDecompress = const False I think we should invert the logic of this (to avoid double negatives) so we have: type ContentType = ByteString decompress :: ContentType - Bool browserDecompress = (/== application/x-tar) defaultDecompress = const True No objections from me. Was the idea that this decompress field then gets added to the Request record? Yes. If so, would simpleHttp be modified to be: simpleHttp :: String - (ContentType - Bool) - m L.ByteString and exporting both browserDecompress and defaultDecompress so they can be used as two sane defaults for the second parameter? I don't want to go this route actually. I think simpleHttp should have the exact same type signature it has route now (thus living up to the name simple). It likely makes sense to use browserDecompress as the default for simpleHttp, and defaultDecompress as the default for parseUrl. Though I don't really have a strong opinion on this either. In either case, I'm thinking we should rename defaultDecompress to alwaysDecompress (my mistake to start off with), to properly indicate what it does. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved
On 11-08-27 04:59 PM, aditya siram wrote: Many times I've changed files, loaded them, hit a compilation error and needed, for example, the inferred type signature of some function. Even though that function hasn't been changed I have to either fix my code, undo a bunch of changes or comment out the last change I made and reload in order to do a :type on the function. This really breaks the flow of development. In #haskell, we came up with the idea of running two instances of ghci. Try loading in one instance first; if good, commit to the other instance too; if bad, you still have the other instance in a functional state. Presumably, this should be automated by some middleware. (We were discussing the prospect of auto-reload, i.e., automatically poll source file timestamps and reload.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Decompressing and http-enumerator
Michael Snoyman wrote: I think we should invert the logic of this (to avoid double negatives) so we have: type ContentType = ByteString decompress :: ContentType - Bool browserDecompress = (/== application/x-tar) defaultDecompress = const True No objections from me. Was the idea that this decompress field then gets added to the Request record? Yes. If so, would simpleHttp be modified to be: simpleHttp :: String - (ContentType - Bool) - m L.ByteString and exporting both browserDecompress and defaultDecompress so they can be used as two sane defaults for the second parameter? I don't want to go this route actually. I think simpleHttp should have the exact same type signature it has route now (thus living up to the name simple). It likely makes sense to use browserDecompress as the default for simpleHttp, and defaultDecompress as the default for parseUrl. Though I don't really have a strong opinion on this either. In either case, I'm thinking we should rename defaultDecompress to alwaysDecompress (my mistake to start off with), to properly indicate what it does. Ok, I'll prepare a patch along these lines and submit a github pull request. Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unexpected Typeable behaviour; Prelude.undefined
The problem with hiding the context in the constructor is that there's no guarantee that the context actually exists in the first place; for example, given this type data IsInt a where Proof :: IsInt Int this is a legal program: foo :: IsInt Bool foo = undefined That said, you are still just fine to hide the context in the constructor at the call site: data MyGADT m where MonadAction :: (Typeable1 m, Monad m) - m () - MyGADT m instance (Typeable1 m, Monad m) = Typeable (MyGADT m) where typeof t = ... getTypeRep :: MyGADT m - TypeRep getTypeRep x@(MonadAction _) = typeof (undefined `asTypeOf` x) Here we unpack the context from x and use it to construct the 'typeof' function for MyGADT m. -- ryan On Mon, Aug 29, 2011 at 2:06 AM, Philip Holzenspies p...@st-andrews.ac.ukwrote: Dear Brandon, Ozgur, et al, Thanks very much for you explanation. This seems to be a perfectly reasonable explanation; the wrapper-types I used probably explicitly invoke typeOf with undefined. The problem here, however, is that in my actual program, I don't use ADTs, but I use GADTs, so as to carry the context (Monad, Typeable1) with the constructor. To get to this context, I must pattern-match with the constructor. It seems hiding contexts (which I really like about GADTs) isn't available consistently. Oh well ;) Regards, Philip On 29 Aug 2011, at 01:20, Brandon Allbery wrote: On Sun, Aug 28, 2011 at 18:44, Philip Holzenspies p...@st-andrews.ac.ukwrote: instance (Typeable1 m, Monad m) = Typeable (MyADT m) where typeOf t@(MyADT _) typeOf is usually invoked with an undefined parameter; it should use types, never values. Here you've defined it to deconstruct what it's passed, which means that anything that uses it in the usual way (`typeOf (undefined :: someType)') will immediately throw undefined. You don't need a deconstructor there; you (correctly) throw away the value, and it doesn't provide any type information not already available from the instance declaration. `typeOf t' should be good enough. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ 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] Pointed, but not Applicative
On Mon, 2011-08-29 at 20:24 -0700, Ryan Ingram wrote: On Sun, Aug 28, 2011 at 8:24 PM, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: f `fmap` FList g = _|_ f `fmap` FList g = map id f `fmap` FList g = map _|_ (+ variation of _|_*) f `fmap` FList g = \bs - map f (g []) ++ bs You mean f `fmap` FList g = FList $ \bs - map f (g []) ++ bs Seems to confirm to second law as well. Regards ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe