Re: [Haskell-cafe] llvm package on Windows
Jacques Carette schrieb: I am trying to install llvm-0.9.0.1 on Windows (through cygwin), on top of a clean install of Haskell Platform 2010.2.0.0. I do cabal install llvm --configure-option --with-llvm-prefix=C:\\llvm (which is where I unpacked llvm-gcc4.2-2.8-x86-mingw43.tar.bz2). This fails with .mingw\bin\ld.exe: cannot find -lLLVMXCoreAsmPrinter (which is indeed the first -l option on the gcc line). Does the LLVMXCoreAsmPrinter library exist on your machine? If not, then certainly building LLVM went wrong. If it exists then my next question would be, whether this is a particular problem with LLVMXCoreAsmPrinter or whether this is just the first library GHC tried to bind to. I could suggest to try to build the current state of the package from http://code.haskell.org/llvm/ but I suspect that the building problem would be the same. [I also tried the llvm-ht package, same issue; I can't tell which of the 2 packages is 'best' from the online doc] llvm-ht was a little modification by me. In the meantime I could incorporate my changes to the main llvm package. I may flag llvm-ht as deprecated. Btw. there is also the haskell-llvm mailing list. http://projects.haskell.org/cgi-bin/mailman/listinfo/haskell-llvm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GSoC Proposal: A 3d visualization of code (packages)
Dear Haskell Programmers, To get some feedback on my proposal here is posting that explains it more detailed: http://tillmannvogt.wordpress.com/2011/03/30/gsoc/ If this succeeds it could become the poster child application for WebGL and there will be an immediate value to all Haskell programmers: Get an overview what is happening. In the long term there is the possibility to have a very powerful UI-library and to be able to combine visualizations with Code. The milestone plan is just to show that it should be doable. The part that is not so clear how to do is the integration with hackage2. It could even be a separate site like haskellers.com that links to various resources. Should a WebGL engine be used (then it should be easy to load a collada file) or can WebGL be integrated in a haskell web framework? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Encoding of Haskell source files
Hello, The Haskell 2010 language specification states that Haskell uses the Unicode character set [1]. I interpret this as saying that, at the lowest level, a Haskell program is a sequence of Unicode code points. The standard doesn't say how such a sequence should be encoded. You can argue that the encoding of source files is not part of the language. But I think it would be highly practical to standardise on an encoding scheme. Strictly speaking it is not possible to reliably exchange Haskell source files on the byte level. If I download some package from hackage I can't tell how the source files are encoded from just looking at the files. I propose a few solutions: A - Choose a single encoding for all source files. This is wat GHC does: GHC assumes that source files are ASCII or UTF-8 only, other encodings are not recognised [2]. UTF-8 seems like a good candidate for such an encoding. B - Specify encoding in the source files. Start each source file with a special comment specifying the encoding used in that file. See Python for an example of this mechanism in practice [3]. It would be nice to use already existing facilities to specify the encoding, for example: {-# ENCODING encoding name #-} An interesting idea in the Python PEP is to also allow a form recognised by most text editors: # -*- coding: encoding name -*- C - Option B + Default encoding Like B, but also choose a default encoding in case no specific encoding is specified. I would further like to propose to specify the encoding of haskell source files in the language standard. Encoding of source files belongs somewhere between a language specification and specific implementations. But the language standard seems to be the most practical place. This is not an official proposal. I am just interested in what the Haskell community has to say about this. Regards, Roel [1] - http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-150002.1 [2] - http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/separate-compilation.html#source-files [3] - http://www.python.org/dev/peps/pep-0263/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Roel van Dijk vandijk.r...@gmail.com Hello, The Haskell 2010 language specification states that Haskell uses the Unicode character set [1]. I interpret this as saying that, at the lowest level, a Haskell program is a sequence of Unicode code points. The standard doesn't say how such a sequence should be encoded. You can argue that the encoding of source files is not part of the language. But I think it would be highly practical to standardise on an encoding scheme. Strictly speaking it is not possible to reliably exchange Haskell source files on the byte level. If I download some package from hackage I can't tell how the source files are encoded from just looking at the files. Not from looking with your eyes perhaps. Does that matter? Your text editor, and the compiler, can surely figure it out for themselves. There aren't many Unicode encoding formats, and there aren't very many possibilities for the leading characters of a Haskell source file, are there? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Proposal: A 3d visualization of code (packages)
2011/4/4 Tillmann Vogt tillmann.v...@rwth-aachen.de: Dear Haskell Programmers, To get some feedback on my proposal here is posting that explains it more detailed: http://tillmannvogt.wordpress.com/2011/03/30/gsoc/ If this succeeds it could become the poster child application for WebGL and there will be an immediate value to all Haskell programmers: Get an overview what is happening. In the long term there is the possibility to have a very powerful UI-library and to be able to combine visualizations with Code. The milestone plan is just to show that it should be doable. The part that is not so clear how to do is the integration with hackage2. It could even be a separate site like haskellers.com that links to various resources. Should a WebGL engine be used (then it should be easy to load a collada file) or can WebGL be integrated in a haskell web framework? Hi, I'm happy to see someone interested in hacking 3D projects in Haskell. But I'm failing at imagining your package visualization. Would it be possible for you to craft some image with some real data from hackage, and show how it would be more useful than, say, a normal web page? Let me quote the three points from your blog: 1. The visualization will let programmers quicker find a library they need (see changes, etc. ), because the visualization algorithm is like reversed pattern recognition to produce most recognizable shapes. 2. The code size, popularity, dependencies, whatever the community demands can be integrated or left away 3. A general way to extend or change the visualization I really think a more concrete (manually crafted) image would help a lot seeing what you mean by 1. I'm wondering how, in 1., it makes it quicker to find what I need if it is not clear what kind of information it will provide. I say it is not clear as point 2 is asking the question of what data is available in the visualization. Point 3 doesn't seem realistic to me. It sounds like a 3d visualization framework is on the way, which is a big undertaking. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: FreeType 2 Bindings
Hi Jason Good luck - I worked on a binding a couple of years ago, but decided that FreeType is really a framework rather than a library. Thus, I felt it would be more pragmatic to write a intermediate C library doing exactly what you need and bind to that rather than bind directly to FreeType. Naturally, I'm not suggesting that you should agree with my analysis - but I would flag a caution that FreeType is very problematic to bind to. The abandoned code is in Copperbox: http://code.google.com/p/copperbox/source/checkout path in the trunk: libs/graphics/FreeType Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Ann: contstuff, dnscache, ihttp, ismtp, netlines, yesod-tableview
Hi Ertugrul, Looks like some interesting projects. For TLS/SSL support, I would look into Vincent Hanquez's tls package[1]. Michael [1] http://hackage.haskell.org/package/tls On Sun, Apr 3, 2011 at 11:09 PM, Ertugrul Soeylemez e...@ertes.de wrote: Hello fellow Haskellers, (once again posted to the cafe, because the Haskell mailing list rejects my mails.) I have released quite a few libraries over time on Hackage. I feel they are stable enough now to announce them here. * contstuff: Fast and flexible monad transformers based on the CPS concept. Mainly it helps getting rid of large transformer stacks, because it unifies some monad transformers (like StateT and ContT), and it is also faster than the naive approach. This library is comparable to a combination of the transformers package with Edward Kmett's monad-ran package, but without hiding the CPS transformation. In early benchmarks ChoiceT turned out to be twice as fast as normal Haskell lists, and it is also a proper list monad transformer. Finally in the Control.ContStuff.Classes module you find lots of useful utility classes, which seem to be unique to contstuff. * dnscache: Handy DNS caching library. This library automatically manages a set of resolver threads for you, which share a reply cache. This allows very fast mass-resolution. The library also comes with a handy command line utility called 'massdns' for quick resolution of even very large lists of entities. Call massdns without arguments to get usage help. * ihttp: This is an HTTP library based on enumerators giving you maximum flexibility and control over the connection. Using proper iteratees you can simply implement e.g. proxy clients (my main use case), but also HTTP servers. Using proper enumeratees you can also encapsulate the connection in an SSL/TLS layer, but unfortunately there doesn't seem to be such an SSL/TLS implementation yet. * ismtp: This is an advanced ESMTP library, which allows you to structure your sessions as you like. It also features an automated resolver for MX records using the dnscache library. Right now there is support for most of the base functionalities of the protocol as specified in RFC 821 (SMTP) and RFC 1425 (service extensions). An update to RFC 2821 is planned, but is not necessary for practical purposes. The new RFC mainly removes some unneeded features and unifies the two mentioned RFCs. Right now there is no support for SMTL (SASL) authentication, but it is planned for a near future release. For the time being you can implement your own iteratees for this purpose, if you depend on authentication. * netlines: This is a library for writing implementations of text-based protocols. In particular it allows reading lines safely from untrusted sources with a maximum length in constant space. * yesod-tableview: For web applications using Michael Snoyman's Yesod web framework this library implements an easy to use table renderer mainly for database records. It is in an early stage of development right now, but as the need arises, I will extend it. To use the networking libraries, you should be familiar with John Millikin's 'enumerator' package. If you're not, I recommend studying it, because it is a useful library for all kinds of stream processing like network connections, files and concurrent channels. All mentioned libraries have been tested extensively for correctness and safety. Especially the networking libraries have undergone a lot of penetration testing. However, I'm only one developer, so I would be glad to hear about any vulnerabilities and other shortcomings you find. Usually I have a very short response time to bugs in these libraries, so please don't hesitate to contact me. Feature requests are also welcome, of course. =) Please note that major version numbers specify interface versions in my libraries. In other words, a new major version of a package usually means that the API has changed in a way, which is likely to break dependent packages. I would like to use this opportunity to thank a few people in particular (alphabetically): - Cale Gibbard, - Edward Kmett, - John Millikin, - Bryan O'Sullivan and - Michael Snoyman. I appreciate your efforts both in libraries and support. Many thanks, guys! Thanks also to the rest of the innovative and helpful Haskell community. Greets, Ertugrul -- Key-ID: E5DD8D11 Ertugrul Soeylemez e...@ertes.de FPrint: 0F12 0912 DFC8 2FC5 E2B8 A23E 6BAC 998E CE40 2012 Keysrv: hkp://subkeys.pgp.net/ -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Proposal: A 3d visualization of code (packages)
Am 04.04.2011 11:06, schrieb Vo Minh Thu: 2011/4/4 Tillmann Vogttillmann.v...@rwth-aachen.de: Dear Haskell Programmers, To get some feedback on my proposal here is posting that explains it more detailed: http://tillmannvogt.wordpress.com/2011/03/30/gsoc/ If this succeeds it could become the poster child application for WebGL and there will be an immediate value to all Haskell programmers: Get an overview what is happening. In the long term there is the possibility to have a very powerful UI-library and to be able to combine visualizations with Code. The milestone plan is just to show that it should be doable. The part that is not so clear how to do is the integration with hackage2. It could even be a separate site like haskellers.com that links to various resources. Should a WebGL engine be used (then it should be easy to load a collada file) or can WebGL be integrated in a haskell web framework? Hi, I'm happy to see someone interested in hacking 3D projects in Haskell. But I'm failing at imagining your package visualization. Would it be possible for you to craft some image with some real data from hackage, and show how it would be more useful than, say, a normal web page? Let me quote the three points from your blog: 1. The visualization will let programmers quicker find a library they need (see changes, etc. ), because the visualization algorithm is like reversed pattern recognition to produce most recognizable shapes. 2. The code size, popularity, dependencies, whatever the community demands can be integrated or left away 3. A general way to extend or change the visualization I really think a more concrete (manually crafted) image would help a lot seeing what you mean by 1. It would look a lot like the second picture with the ~300 blocks. I would rather like to generate the picture automatically than to spend some days with sketchup. I'm wondering how, in 1., it makes it quicker to find what I need if it is not clear what kind of information it will provide. I say it is not clear as point 2 is asking the question of what data is available in the visualization. The quickest way to find a library is to know the name and search it in google or with Ctr+F on the website. But if you have forgotten the name but roughly know the size or to what area it belonged (i.e. graphics) you could find it in the overview mode. If you search for a tall green building (assigning code size to building size) one can find it in an instant on the second picture. Try to find a library in a listing of 300 names. Point 3 doesn't seem realistic to me. It sounds like a 3d visualization framework is on the way, which is a big undertaking. Graph drawing is hard, thats why I wouldn't try to reprogram Graphviz in 3 months, but softwarevisualization is in my impression not so hard. It like the overly quoted Lindemayer-systems that you can achieve a lot with very few commands. A framework sounds a little big. Currently I just want to see some images like the second. But I have approached the generation part as formally as possible to do it right. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Colin Adams colinpaulad...@googlemail.com: Not from looking with your eyes perhaps. Does that matter? Your text editor, and the compiler, can surely figure it out for themselves. 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? There aren't many Unicode encoding formats From casually scanning some articles about encodings I can count at least 70 character encodings [1]. and there aren't very many possibilities for the leading characters of a Haskell source file, are there? Since a Haskell program is a sequence of Unicode code points the programmer can choose from up to 1,112,064 characters. Many of these can legitimately be part of the interface of a module, as function names, operators or names of types. [1] - http://en.wikipedia.org/wiki/Character_encoding ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. 2011/4/4 Roel van Dijk vandijk.r...@gmail.com 2011/4/4 Colin Adams colinpaulad...@googlemail.com: Not from looking with your eyes perhaps. Does that matter? Your text editor, and the compiler, can surely figure it out for themselves. 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? There *is* an algorithm for determining the encoding of an XML file based on a combination of the BOM (Byte Order Marker) and an assumption that the file will start with a XML declaration (i.e., ?xml ... ?). But this isn't capable of determining every possible encoding on the planet, just distinguishing amongst varieties of UTF-(8|16|32)/(big|little) endian and EBCIDC. It cannot tell the difference between UTF-8, Latin-1, and Windows-1255 (Hebrew), for example. There aren't many Unicode encoding formats From casually scanning some articles about encodings I can count at least 70 character encodings [1]. I think the implication of Unicode encoding formats is something in the UTF family. An encoding like Latin-1 or Windows-1255 can be losslessly translated into Unicode codepoints, but it's not exactly an encoding of Unicode, but rather a subset of Unicode. and there aren't very many possibilities for the leading characters of a Haskell source file, are there? Since a Haskell program is a sequence of Unicode code points the programmer can choose from up to 1,112,064 characters. Many of these can legitimately be part of the interface of a module, as function names, operators or names of types. My guess is that a large subset of Haskell modules start with one of left brace (starting with comment or language pragma), m (for starting with module), or some whitespace character. So it *might* be feasible to take a guess at things. But as I said before: I like UTF-8. Is there anyone out there who has a compelling reason for writing their Haskell source in EBCDIC? Michael ___ 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 Monday 04 April 2011 11:50:03, Roel van Dijk wrote: and there aren't very many possibilities for the leading characters of a Haskell source file, are there? Since a Haskell program is a sequence of Unicode code points the programmer can choose from up to 1,112,064 characters. Many of these can legitimately be part of the interface of a module, as function names, operators or names of types. Colin spoke of *leading* characters, for .hs files, that drastically reduces the possibilities - not for .lhs, though. ___ 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 4 April 2011 12:22, Michael Snoyman mich...@snoyman.com wrote: Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. This is also my preferred choice. There *is* an algorithm for determining the encoding of an XML file based on a combination of the BOM (Byte Order Marker) and an assumption that the file will start with a XML declaration (i.e., ?xml ... ?). But this isn't capable of determining every possible encoding on the planet, just distinguishing amongst varieties of UTF-(8|16|32)/(big|little) endian and EBCIDC. It cannot tell the difference between UTF-8, Latin-1, and Windows-1255 (Hebrew), for example. I think I was confused between character encodings in general and Unicode encodings. I think the implication of Unicode encoding formats is something in the UTF family. An encoding like Latin-1 or Windows-1255 can be losslessly translated into Unicode codepoints, but it's not exactly an encoding of Unicode, but rather a subset of Unicode. That would validate Colin's point about there not being that many encodings. My guess is that a large subset of Haskell modules start with one of left brace (starting with comment or language pragma), m (for starting with module), or some whitespace character. So it *might* be feasible to take a guess at things. But as I said before: I like UTF-8. Is there anyone out there who has a compelling reason for writing their Haskell source in EBCDIC? I think I misinterpreted the word 'leading'. I thought Colin meant most used. The set of characters with which Haskell programmes start is indeed small. But like you I prefer no guessing and just default to UTF-8. ___ 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 Monday 04 April 2011 10:46:46, Roel van Dijk wrote: I propose a few solutions: A - Choose a single encoding for all source files. This is wat GHC does: GHC assumes that source files are ASCII or UTF-8 only, other encodings are not recognised [2]. UTF-8 seems like a good candidate for such an encoding. If there's only a single encoding recognised, UTF-8 surely should be the one (though perhaps Windows users might disagree, iirc, Windows uses UCS2 as standard encoding). B - Specify encoding in the source files. Start each source file with a special comment specifying the encoding used in that file. See Python for an example of this mechanism in practice [3]. It would be nice to use already existing facilities to specify the encoding, for example: {-# ENCODING encoding name #-} An interesting idea in the Python PEP is to also allow a form recognised by most text editors: # -*- coding: encoding name -*- C - Option B + Default encoding Like B, but also choose a default encoding in case no specific encoding is specified. default = UTF-8 Laziness makes me prefer that over B. I would further like to propose to specify the encoding of haskell source files in the language standard. Encoding of source files belongs somewhere between a language specification and specific implementations. But the language standard seems to be the most practical place. I'd agree. This is not an official proposal. I am just interested in what the Haskell community has to say about this. Regards, Roel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Roel van Dijk vandijk.r...@gmail.com: On 4 April 2011 12:22, Michael Snoyman mich...@snoyman.com wrote: Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. This is also my preferred choice. +1 I'm also in favor of sticking with UTF-8 and being done with it. All of Hackage *today* is UTF-8 (ASCII included), why open a can of worms? Also, this means that we would be standardizing the current practice. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fast conversion between Vector Double and Vector CDouble
Hello, I just rewrote my levmar library[1] to use Vectors (from the vector package[2]) instead of lists. I was expecting to see a significant performance improvement. Unfortunately I only saw a 10% improvement. However, I noticed I had a lot of conversions from Vector Double to Vector CDouble and visa versa in my code: import Data.Vector.Storable ( Vector ) mapRealToFrac ∷ (Storable α, Storable β, Real α, Fractional β) ⇒ Vector α → Vector β mapRealToFrac = VS.map realToFrac When I replace this with: mapRealToFrac = unsafeCoerce My application computes the same result but does it 28 times faster! My question are: 1) Is this always safe? In other words: are the runtime representations of Double and CDouble always equivalent or do they vary between platforms? 2) Can the same improvement be accomplished using RULE pragma's? 3) Are there disadvantages of using CDouble instead of Double in the levmar API? For some reason it feels wrong to use CDouble in the API but I don't have a good argument against it yet. Thanks, Bas [1] http://hackage.haskell.org/package/levmar [2] http://hackage.haskell.org/package/vector ___ 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 4 April 2011 11:34, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: If there's only a single encoding recognised, UTF-8 surely should be the one (though perhaps Windows users might disagree, iirc, Windows uses UCS2 as standard encoding). Windows APIs use UTF-16, but the encoding of files (which is the relevant point here) is almost uniformly UTF-8 - though of course you can find legacy apps making other choices. Cheers, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fast conversion between Vector Double and Vector CDouble
On Monday 04 April 2011 13:54:39, Bas van Dijk wrote: Hello, I just rewrote my levmar library[1] to use Vectors (from the vector package[2]) instead of lists. I was expecting to see a significant performance improvement. Unfortunately I only saw a 10% improvement. However, I noticed I had a lot of conversions from Vector Double to Vector CDouble and visa versa in my code: import Data.Vector.Storable ( Vector ) mapRealToFrac ∷ (Storable α, Storable β, Real α, Fractional β) ⇒ Vector α → Vector β mapRealToFrac = VS.map realToFrac When I replace this with: mapRealToFrac = unsafeCoerce My application computes the same result but does it 28 times faster! My question are: 1) Is this always safe? In other words: are the runtime representations of Double and CDouble always equivalent or do they vary between platforms? It's not always safe, it seems to be different for NHC. In Foreign.C.Types, you find #ifndef __NHC__ snip -- | These types are are represented as @newtype@s of paraphrase the corresponding Haskell types snip #else snip #endif for the integral and floating types. So for the time being, it's safe except possibly on NHC, as long as it is (and can be) only used to convert between the corresponding Haskell and C types (so #ifdef __NHC__ mapRealToFrac = VS.map realToFrac #else mapRealToFrac = unsafeCoerce #endif would also cater for NHC). 2) Can the same improvement be accomplished using RULE pragma's? For GHC, probably, but rule-firings aren't always predictable. For example, it could be that the rule for realToFrac fires first. 3) Are there disadvantages of using CDouble instead of Double in the levmar API? You'd have to write the conversion code every time you use it from Haskell, wouldn't you? For some reason it feels wrong to use CDouble in the API but I don't have a good argument against it yet. Thanks, Bas [1] http://hackage.haskell.org/package/levmar [2] http://hackage.haskell.org/package/vector ___ 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 Mon, 4 Apr 2011 13:30:08 +0100, you wrote: Windows APIs use UTF-16... The newer ones, at least. The older ones usually come in two flavors, UTF-16LE and 8-bit code page-based. ...but the encoding of files (which is the relevant point here) is almost uniformly UTF-8 - though of course you can find legacy apps making other choices. If you're talking about files written and read by the operating system itself, then perhaps. But my experience is that there are a lot of applications that use UTF-16LE, especially ones that typically only work with smaller files (configuration files, etc.). As for Haskell, I would still vote for UTF-8 only, though. The only reason to favor anything else is legacy compatibility with existing Haskell source files, and that isn't really an issue here. -Steve Schafer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
Michael Snoyman mich...@snoyman.com writes: My guess is that a large subset of Haskell modules start with one of left brace (starting with comment or language pragma), m (for starting with module), or some whitespace character. So it *might* be feasible to take a guess at things. But as I said before: I like UTF-8. Is there anyone out there who has a compelling reason for writing their Haskell source in EBCDIC? Probably not EBCDIC. :-) Correct me if I'm wrong here, but I think nobody has compelling reasons for using any other Unicode format than UTF-8. Although some systems use UTF-16 (or some approximation thereof) internally, UTF-8 seems to be the universal choice external encoding. However, there probably exists a bit of code using Latin-1 and Windows charsets, and here leading characters aren't going to help you all that much. I think the safest thing to do is to require source to be ASCII, and provide escapes for code points 127... -k -- If I haven't seen further, it is by standing in the footprints of giants ___ 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 Mon, Apr 4, 2011 at 7:30 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 4 April 2011 11:34, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: If there's only a single encoding recognised, UTF-8 surely should be the one (though perhaps Windows users might disagree, iirc, Windows uses UCS2 as standard encoding). Windows APIs use UTF-16, but the encoding of files (which is the relevant point here) is almost uniformly UTF-8 - though of course you can find legacy apps making other choices. Would we need to specifically allow for a Windows-style leading BOM in UTF-8 documents? I can never remember if it is truly a part of UTF-8 or not. Cheers, Max ___ 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] Encoding of Haskell source files
BOM is not part of UTF8, because UTF8 is byte-oriented. But applications should be prepared to read and discard it, because some applications erroneously generate it.Regards, MalcolmOn 04 Apr, 2011,at 02:09 PM, Antoine Latter aslat...@gmail.com wrote:On Mon, Apr 4, 2011 at 7:30 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 4 April 2011 11:34, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: If there's only a single encoding recognised, UTF-8 surely should be the one (though perhaps Windows users might disagree, iirc, Windows uses UCS2 as standard encoding). Windows APIs use UTF-16, but the encoding of files (which is the relevant point here) is almost uniformly UTF-8 - though of course you can find legacy apps making other choices. Would we need to specifically allow for a Windows-style leading BOM in UTF-8 documents? I can never remember if it is truly a part of UTF-8 or not. Cheers, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
That's not what the official unicode site says in its FAQ: http://unicode.org/faq/utf_bom.html#bom4 and http://unicode.org/faq/utf_bom.html#bomhttp://unicode.org/faq/utf_bom.html#bom4 5 Cheers, -Tako On Mon, Apr 4, 2011 at 15:18, malcolm.wallace malcolm.wall...@me.comwrote: BOM is not part of UTF8, because UTF8 is byte-oriented. But applications should be prepared to read and discard it, because some applications erroneously generate it. Regards, Malcolm On 04 Apr, 2011,at 02:09 PM, Antoine Latter aslat...@gmail.com wrote: On Mon, Apr 4, 2011 at 7:30 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 4 April 2011 11:34, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: If there's only a single encoding recognised, UTF-8 surely should be the one (though perhaps Windows users might disagree, iirc, Windows uses UCS2 as standard encoding). Windows APIs use UTF-16, but the encoding of files (which is the relevant point here) is almost uniformly UTF-8 - though of course you can find legacy apps making other choices. Would we need to specifically allow for a Windows-style leading BOM in UTF-8 documents? I can never remember if it is truly a part of UTF-8 or not. Cheers, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fast conversion between Vector Double and Vector CDouble
On 4 April 2011 14:41, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Monday 04 April 2011 13:54:39, Bas van Dijk wrote: Hello, I just rewrote my levmar library[1] to use Vectors (from the vector package[2]) instead of lists. I was expecting to see a significant performance improvement. Unfortunately I only saw a 10% improvement. However, I noticed I had a lot of conversions from Vector Double to Vector CDouble and visa versa in my code: import Data.Vector.Storable ( Vector ) mapRealToFrac ∷ (Storable α, Storable β, Real α, Fractional β) ⇒ Vector α → Vector β mapRealToFrac = VS.map realToFrac When I replace this with: mapRealToFrac = unsafeCoerce My application computes the same result but does it 28 times faster! My question are: 1) Is this always safe? In other words: are the runtime representations of Double and CDouble always equivalent or do they vary between platforms? It's not always safe, it seems to be different for NHC. In Foreign.C.Types, you find #ifndef __NHC__ snip -- | These types are are represented as @newtype@s of paraphrase the corresponding Haskell types snip #else snip #endif for the integral and floating types. So for the time being, it's safe except possibly on NHC, as long as it is (and can be) only used to convert between the corresponding Haskell and C types (so #ifdef __NHC__ mapRealToFrac = VS.map realToFrac #else mapRealToFrac = unsafeCoerce #endif would also cater for NHC). 2) Can the same improvement be accomplished using RULE pragma's? For GHC, probably, but rule-firings aren't always predictable. For example, it could be that the rule for realToFrac fires first. 3) Are there disadvantages of using CDouble instead of Double in the levmar API? You'd have to write the conversion code every time you use it from Haskell, wouldn't you? For some reason it feels wrong to use CDouble in the API but I don't have a good argument against it yet. Thanks, Bas [1] http://hackage.haskell.org/package/levmar [2] http://hackage.haskell.org/package/vector Thanks for the clarification Daniel. I just read[1] it's also possible to directly use Double and Float in an FFI import declaration. I always assumed you could only use the C types from Foreign.C.Types. So I think I'm going to change bindings-levmar[2] to use Double and Float instead of CDouble and CFloat. This way I don't even need to map. Bas [1] http://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1560008.4.2 [2] http://hackage.haskell.org/package/bindings-levmar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Ketil Malde ke...@malde.org: I think the safest thing to do is to require source to be ASCII, and provide escapes for code points 127... I used to think that until I realised it meant having -- Author: Ma\xef N\xe5me In code, single characters aren't bad (does Haskell have something like Python's named escapes (\N{small letter a with ring}?) but reading UI strings is less fun. Also, unicode symbols for - and the like are becoming more popular. --Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Ketil Malde ke...@malde.org: I think the safest thing to do is to require source to be ASCII, and provide escapes for code points 127... I do not think that that is the safest option. The safest is just writing down whatever GHC does. Escape codes for non-ASCII would break a lot of packages and make programming really painful. Consider the following, utf-8 encoded, file: http://code.haskell.org/numerals/test/Text/Numeral/Language/ZH/TestData.hs I don't want to imagine writing that with escape characters. It would also be very error prone, not being able to readily read what you write. But the overall consensus appears to be UTF-8 as the default encoding. I will write an official proposal to amend the haskell language specification. (Probably this evening, utc+1). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] broken on build encoding
Hi, cafe, I always get the following build failure when I try to install encoding: Configuring encoding-0.6.4... Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package haskell98-1.0.1.1 requires random-1.0.0.2 package HaXml-1.20.2 requires random-1.0.0.2 package random-1.0.0.2 requires time-1.1.4 package random-1.0.0.2 requires time-1.2.0.4 Preprocessing library encoding-0.6.4... Building encoding-0.6.4... Data/Encoding/ByteSource.hs:124:0: warning: extra tokens at end of #ifndef directive Data/Encoding/ByteSink.hs:104:0: warning: extra tokens at end of #ifndef directive [ 1 of 65] Compiling Data.Static ( Data/Static.hs, dist/build/Data/Static.o ) [ 2 of 65] Compiling Data.Array.Static ( Data/Array/Static.hs, dist/build/Data/Array/Static.o ) Data/Array/Static.hs:14:35: Warning: Bindings containing unlifted types must use an outermost bang pattern: { (I# ri) = index (s, e) i } *** This will be an error in GHC 6.14! Fix your code now! In the expression: let (I# ri) = index (s, e) i in extract addr ri In the definition of `!': ! (StaticArray s e addr) i = let (I# ri) = index ... i in extract addr ri [ 3 of 65] Compiling Data.Map.Static ( Data/Map/Static.hs, dist/build/Data/Map/Static.o ) [ 4 of 65] Compiling Control.Throws ( Control/Throws.hs, dist/build/Control/Throws.o ) [ 5 of 65] Compiling Data.Encoding.Exception ( Data/Encoding/Exception.hs, dist/build/Data/Encoding/Exception.o ) [ 6 of 65] Compiling Data.Encoding.ByteSource ( Data/Encoding/ByteSource.hs, dist/build/Data/Encoding/ByteSource.o ) Data/Encoding/ByteSource.hs:151:17: Not in scope: data constructor `State' cabal: Error: some packages failed to install: encoding-0.6.4 failed during the building phase. The exception was: ExitFailure 1https://mail.google.com/mail/?shva=1#compose I manually installed a ghc-6.12.3, a ubuntu ghc-6.12.1, all the same? anybody can provide helps? 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
From: Michael Snoyman mich...@snoyman.com Sent: Mon, April 4, 2011 5:22:02 AM Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. If by insist, you mean the standard insist that implementations support UTF-8 by default. The rest of the standard already just talks about sequences of unicode characters, so I don't see much to be gained by prohibiting other encodings. In particular, I have read that systems set up for east asian scripts often use UTF-16 as a default encoding. Brandon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HDF5 binding (was: why is ghci trying to load hsc file ??)
On Apr 3, 2011, at 10:43 PM, mauricio.antu...@gmail.com wrote: I worked out a small hdf5 binding using cabal and bindings-DSL and sqlite3 as my example. I just wanted to add that I also started an HDF5 binding recently (using hsc2hs only). It does more than enough for me ATM, so I don't develop it actively, but if you want to pursue this (and I think it would be a useful addition to Hackage), we may share experience and code. My binding is part of a bigger project, but I meant to split it out anyway. What an interesting coincidence, that makes at least three of us. Apparently it's an idea whose time has come. Mine is also an incomplete low-level binding but is currently under semi-active development and I aim to make it cover the entire hdf5.h interface. If anyone is interested in it I've put it on github at: https://github.com/mokus0/bindings-hdf5 Bindings to the full hdf5 were supposed to be in the example set for bindings-DSL. It doesn't use pkg-config, though, and hdf5 developers didn't like the idea of adding support. I wanted reference bindings-* libraries to be free of linking problems some users might not be able to solve or understand, so I gave up. That seems strange to me - pkg-config is such a useful system, and support for it is incredibly easy to add and practically zero- maintenance. Was it that they didn't find it worth the programmer time to figure out how to add pkg-config support or did they have specific objections? All it seems to take is to generate a file with about 10 lines of text and install it to the right place. In any case, though, the fact that current versions doesn't support it means that a Haskell binding package has to work around that for several years to come, since most stable linux distros wouldn't pick up an updated version for quite some time. Currently I've got a template hdf5.pc file in the source tree which can be customized and dropped into the appropriate directory. It's a lot less manual than it ought to be, but it's at least a lot less ugly than hard-coding my development machine's include and lib paths. Eventually my plan is to use a cabal flag to control whether it looks for hdf5 as using pkgconfig-depends or just extra-libs, with some Setup.hs logic to check whether the former will work and set the flag appropriately. Incidentally, I've thought many times before that it sure would be great if cabal's backtracking search would consider more than just haskell package dependencies. In this case, it would be really nice if it would backtrack on an unsatisfiable pkg-config dependency. In the past I've come across cases where it would have been very helpful to support backtracking on buildable: False. Maybe I'll take a look one of these days at how hard that would be to change. I suspect that to do so in a backward-compatible way would take a lot of work though, because of the way Cabal exposes its internal types to Setup.hs files. -- James ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Brandon Moore brandon_m_mo...@yahoo.com The rest of the standard already just talks about sequences of unicode characters, so I don't see much to be gained by prohibiting other encodings. In particular, I have read that systems set up for east asian scripts often use UTF-16 as a default encoding. Presumably because this will use less disk space on average. I too don't see any reason to forbid other Unicode encodings. Perhaps mandate support for UTF-8, and allow others with a pragma. But unless someone adds support to a Haskell compiler for such a pragma, it will be fairly pointless putting this in the standard. -- 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] broken on build encoding
On Monday 04 April 2011 16:19:46, Gang Yu wrote: Hi, cafe, I always get the following build failure when I try to install encoding: Configuring encoding-0.6.4... Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package haskell98-1.0.1.1 requires random-1.0.0.2 package HaXml-1.20.2 requires random-1.0.0.2 package random-1.0.0.2 requires time-1.1.4 package random-1.0.0.2 requires time-1.2.0.4 That looks as though you have two random-1.0.0.2 packages (and two time packages), probably one in the global package-db and one in the user-db. haskell98 depends on the one in the global db and probably HaXml depends on the one in the user-db. For some package you installed (or did you perchance run cabal upgrade?), cabal seems to have reinstalled random and time (possibly more), that's not good. Ask ghc-pkg about broken packages, $ ghc-pkg check You might need to remove packages from the user-db [ 6 of 65] Compiling Data.Encoding.ByteSource ( Data/Encoding/ByteSource.hs, dist/build/Data/Encoding/ByteSource.o ) Data/Encoding/ByteSource.hs:151:17: Not in scope: data constructor `State' You have mtl-2.*, but encoding would need mtl-1.* it seems, but it hasn't put an upper bound on that dependency. Notify author/maintainer. I manually installed a ghc-6.12.3, a ubuntu ghc-6.12.1, all the same? anybody can provide helps? thanks 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.*). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
2011/4/4 Brandon Moore brandon_m_mo...@yahoo.com: From: Michael Snoyman mich...@snoyman.com Sent: Mon, April 4, 2011 5:22:02 AM Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. If by insist, you mean the standard insist that implementations support UTF-8 by default. No, I mean that compliant compilers should only support UTF-8. I don't see a reason to allow the creation of Haskell files that can only be read by some compilers. The rest of the standard already just talks about sequences of unicode characters, so I don't see much to be gained by prohibiting other encodings. In particular, I have read that systems set up for east asian scripts often use UTF-16 as a default encoding. I don't know about that, but I'd be very surprised if there are any editors out there that don't support UTF-8. If a user is inconvenienced once because he/she needs to change the default encoding to UTF-8, and the result is all Haskell files share the same encoding, I'm OK with that. @Colin: Even if UTF-16 was more space-efficient than UTF-8 (which I highly doubt[1]), I'd be incredibly surprised if this held true for Haskell source, which will almost certainly be at least 90% code-points below 128. For those code points, UTF-16 is twice the size as UTF-8. Michael [1] http://www.haskell.org/pipermail/haskell-cafe/2010-August/082268.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
+1 for UTF-8 only. Brandon Moore wrote: ...I don't see much to be gained by prohibiting other encodings. Universal portability of Haskell source code with respect to its encoding is to be gained. We can achieve that simplicity now with almost no cost. Why miss the opportunity? In particular, I have read that systems set up for east asian scripts often use UTF-16 as a default encoding. Default encoding is not an issue for any normal source code editing tool. Thanks, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fast conversion between Vector Double and Vector CDouble
On 2011-04-04 13:54 +0200, Bas van Dijk wrote: However, I noticed I had a lot of conversions from Vector Double to Vector CDouble and visa versa in my code: import Data.Vector.Storable ( Vector ) mapRealToFrac ∷ (Storable α, Storable β, Real α, Fractional β) ⇒ Vector α → Vector β mapRealToFrac = VS.map realToFrac When I replace this with: mapRealToFrac = unsafeCoerce My application computes the same result but does it 28 times faster! Note that even if Double and CDouble have identical representations, unsafeCoerce does not perform the same conversion as realToFrac -- the latter does conversion to/from Rational and thus munges all values not representable therein. This also happens to be why it is slow. Some real examples, in GHCi: realToFrac (0/0 :: Double) :: CDouble -Infinity unsafeCoerce (0/0 :: Double) :: CDouble NaN realToFrac (-0 :: Double) :: CDouble 0.0 unsafeCoerce (-0 :: Double) :: CDouble -0.0 Using realToFrac to convert between different floating types is even more fun: realToFrac (1/0 :: Float) :: Double 3.402823669209385e38 Nice! My question are: 1) Is this always safe? In other words: are the runtime representations of Double and CDouble always equivalent or do they vary between platforms? Probably not, but realToFrac isn't really safe, either (as above). 2) Can the same improvement be accomplished using RULE pragma's? No, because the two methods do not compute the same function. However, there are (or were) broken RULE pragmas in GHC which do this sort of transformation. Such RULEs make realToFrac really fun because your program's correctness will depend on whether or not GHC decides to inline things. -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
malcolm.wallace wrote: BOM is not part of UTF8, because UTF8 is byte-oriented. But applications should be prepared to read and discard it, because some applications erroneously generate it. For maximum portability, the standard should be require compilers to accept and discard an optional BOM as the first character of a source code file. Tako Schotanus wrote: That's not what the official unicode site says in its FAQ: http://unicode.org/faq/utf_bom.html#bom4 and http://unicode.org/faq/utf_bom.html#bom5 That FAQ clearly states that BOM is part of some protocols. It carefully avoids stating whether it is part of the encoding. It is certainly not erroneous to include the BOM if it is part of the protocol for the applications being used. Applications can include whatever characters they'd like, and they can use whatever handshake mechanism they'd like to agree upon an encoding. The BOM mechanism is common on the Windows platform. It has since appeared in other places as well, but it is certainly not universally adopted. Python supports a pseudo-encoding called utf8-bom that automatically generates and discards the BOM in support of that handshake mechanism But it isn't really an encoding, it's a convenience. Part of the source of all this confusion is some documentation that appeared in the past on Microsoft's site which was unclear about the fact that the BOM handshake is a protocol adopted by Microsoft, not a part of the encoding itself. Some people claim that this was intentional, part of the extend and embrace tactic Microsoft allegedly employed in those days in an effort to expand its monopoly. The wording of the Unicode FAQ is obviously trying to tip-toe diplomatically around this issue without arousing the ire of either pro-Microsoft or anti-Microsoft developers. Thanks, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fast conversion between Vector Double and Vector CDouble
On Mon, Apr 4, 2011 at 6:41 AM, Bas van Dijk v.dijk@gmail.com wrote: Thanks for the clarification Daniel. I just read[1] it's also possible to directly use Double and Float in an FFI import declaration. I always assumed you could only use the C types from Foreign.C.Types. So I think I'm going to change bindings-levmar[2] to use Double and Float instead of CDouble and CFloat. This way I don't even need to map. It's just that on some platforms/Haskell implementations the Haskell Double/Float may not line up with the C side. If you use CDouble/CFloat it will line up. Compared to unsafeCoerce, I would hope you'd get a C compile error on those platforms, but I don't know for certain if that's the case. In my opinion, it's the conversion functions that need to be fixed. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HDF5 binding (was: why is ghci trying to load hsc file ??)
Bindings to the full hdf5 were supposed to be in the example set for bindings-DSL. It doesn't use pkg-config, though, and hdf5 developers didn't like the idea of adding support. [...] That seems strange to me - pkg-config is such a useful system, and support for it is incredibly easy to add and practically zero- maintenance. [...] I have to start asking for forgiveness. In fact, PETSc (http://www.mcs.anl.gov/petsc) developers refused pkg-config, not HDF5. I investigated several libraries for numerical and massive data processing, and most didn't had pkg-config support. I started asking about it at pkg-scicomp-devel debian list, and then Tollef (maintainer of pkg-config): http://lists.alioth.debian.org/pipermail/pkg-scicomp-devel/2009-September/004507.html http://thread.gmane.org/gmane.comp.package-management.pkg-config/345 After learning from them that pkg-config files belong to upstream packages, not distribution packages, I asked PETSc guys. Unfortunately, their petsc-maint mainling list doesn't seem to have an external archive. But Matthew Knepley, from PETSc, said that we do not use that system. It's unreliable, and in my opinion, one of the worst designs possible. They (Matthew and Satish Balay) suggested that we use the makefile targets which give the include and library information. I'm not sure how practical that is with cabal, but I gave up before trying harder and decided to focus on packages with pkg-config already available. I think 'hmatrix' package on hackage uses a script to check for dependencies, but I didn't read enough to check how portable that method can be. Currently I've got a template hdf5.pc file in the source tree which can be customized and dropped into the appropriate directory. It's a lot less manual than it ought to be, but it's at least a lot less ugly than hard-coding my development machine's include and lib paths. Maybe it's worth contacting HDF5 guys about that. Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Using _ on the RHS of an equation?
I think I got this idea from JHC, but I'm unable to find it documented in the JHC manual at the moment. The idea is that when _ appears on the RHS of an equation it is another name for undefined. Here is a hypothetical example, inspired by code I've seen in FFI definitions: \begin{code} {-# LANGUAGE EmptyDataDecls #-} data Bar instance Storable Bar where sizeOf _ = sizeOf #{size struct Bar} alignment _ = alignment (_ :: CDouble) -- here we could have just as succinctly said alignment (1 :: CDouble) data Foo -- the struct Foo on the C side contains a Bar instance Storable Foo where sizeOf _ = sizeOf #{size struct Foo} alignment _ = alignment (_ :: Bar) -- we can't instantiate a Bar \end{code} 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? Thanks, Jason ___ 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 April 2011 22:42, Jason Dagit dag...@gmail.com 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 wish for having ⊥ available as 'undefined' without needing to write it between parenthesis (currently it is interpreted as an operator). Bas ___ 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 Mon, Apr 4, 2011 at 2:48 PM, Bas van Dijk v.dijk@gmail.com wrote: On 4 April 2011 22:42, Jason Dagit dag...@gmail.com 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 wish for having ⊥ available as 'undefined' without needing to write it between parenthesis (currently it is interpreted as an operator). Slightly harder to locate on the keyboard, but that would be nice! Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Encoding of Haskell source files
I made an official proposal on the haskell-prime list: http://www.haskell.org/pipermail/haskell-prime/2011-April/003368.html Let's have further discussion there. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] lhs2tex and comment
Hi! I have problems with lhs2tex and nested (long) comments. It formats it all in one long line and does not wrap it. Is there a way to define those comments so that it would maybe automatically wrap them at the end of the page? (And still take into the account possible indentation of comments.) Or at least to not ignore newlines in comments? I am using poly mode. Mitar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] broken on build encoding
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)) arising from the superclasses of an instance declaration at Data/Encoding/ByteSource.hs:131:9-61 Possible fix: add an instance declaration for (Monad (Either DecodingException)) In the instance declaration for `ByteSource (StateT [Char] (Either DecodingException))' Data/Encoding/ByteSource.hs:141:13: No instance for (Monad (Either DecodingException)) arising from a use of `get' at Data/Encoding/ByteSource.hs:141:13-15 Possible fix: add an instance declaration for (Monad (Either DecodingException)) In a stmt of a 'do' expression: chs - get In the expression: do { chs - get; res - act; put chs; return res } In the definition of `fetchAhead': fetchAhead act = do { chs - get; res - act; put chs; } Data/Encoding/ByteSource.hs:160:9: No instance for (Monad (Either DecodingException)) arising from the superclasses of an instance declaration at Data/Encoding/ByteSource.hs:160:9-68 Possible fix: add an instance declaration for (Monad (Either DecodingException)) In the instance declaration for `ByteSource (StateT BS.ByteString (Either DecodingException))' Data/Encoding/ByteSource.hs:171:9: No instance for (Monad (Either DecodingException)) arising from the superclasses of an instance declaration at Data/Encoding/ByteSource.hs:171:9-69 Possible fix: add an instance declaration for (Monad (Either DecodingException)) In the instance declaration for `ByteSource (StateT LBS.ByteString (Either DecodingException))' cabal: Error: some packages failed to install: encoding-0.6.4 failed during the building phase. The exception was: ExitFailure 1 gang@gang-laptop:~$ ghc-pkg list /var/lib/ghc-6.12.1/package.conf.d Cabal-1.8.0.2 array-0.3.0.0 base-3.0.3.2 base-4.2.0.0 bin-package-db-0.0.0.0 bytestring-0.9.1.5 containers-0.3.0.0 directory-1.0.1.0 dph-base-0.4.0 dph-par-0.4.0 dph-prim-interface-0.4.0 dph-prim-par-0.4.0 dph-prim-seq-0.4.0 dph-seq-0.4.0 extensible-exceptions-0.1.1.1 filepath-1.1.0.3 ghc-6.12.1 ghc-binary-0.5.0.2 ghc-prim-0.2.0.0 haskell98-1.0.1.1 hpc-0.5.0.4 integer-gmp-0.2.0.0 old-locale-1.0.0.2 old-time-1.0.0.3 pretty-1.0.1.1 process-1.0.1.2 random-1.0.0.2 rts-1.0 syb-0.1.0.2 template-haskell-2.4.0.0 time-1.1.4 unix-2.4.0.0 utf8-string-0.3.4 /home/gang/.ghc/i386-linux-6.12.1/package.conf.d HaXml-1.20.2 binary-0.5.0.2 directory-1.1.0.0 mtl-1.1.0.2 polyparse-1.5 regex-base-0.93.2 regex-compat-0.93.1 regex-posix-0.94.4 transformers-0.2.2.0 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 Mon, Apr 4, 2011 at 17:51, Yitzchak Gale g...@sefer.org wrote: malcolm.wallace wrote: BOM is not part of UTF8, because UTF8 is byte-oriented. But applications should be prepared to read and discard it, because some applications erroneously generate it. For maximum portability, the standard should be require compilers to accept and discard an optional BOM as the first character of a source code file. Tako Schotanus wrote: That's not what the official unicode site says in its FAQ: http://unicode.org/faq/utf_bom.html#bom4 and http://unicode.org/faq/utf_bom.html#bom5 That FAQ clearly states that BOM is part of some protocols. It carefully avoids stating whether it is part of the encoding. It is certainly not erroneous to include the BOM if it is part of the protocol for the applications being used. Applications can include whatever characters they'd like, and they can use whatever handshake mechanism they'd like to agree upon an encoding. The BOM mechanism is common on the Windows platform. It has since appeared in other places as well, but it is certainly not universally adopted. Python supports a pseudo-encoding called utf8-bom that automatically generates and discards the BOM in support of that handshake mechanism But it isn't really an encoding, it's a convenience. Part of the source of all this confusion is some documentation that appeared in the past on Microsoft's site which was unclear about the fact that the BOM handshake is a protocol adopted by Microsoft, not a part of the encoding itself. Some people claim that this was intentional, part of the extend and embrace tactic Microsoft allegedly employed in those days in an effort to expand its monopoly. The wording of the Unicode FAQ is obviously trying to tip-toe diplomatically around this issue without arousing the ire of either pro-Microsoft or anti-Microsoft developers. Some reliable sources for all this would be entertaining (although irrelevant for the rest of this discussion). Cheers, -Tako ___ 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 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. ___ 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 Mon, Apr 4, 2011 at 3:52 PM, Roel van Dijk vandijk.r...@gmail.comwrote: I made an official proposal on the haskell-prime list: http://www.haskell.org/pipermail/haskell-prime/2011-April/003368.html Let's have further discussion there. I'm not on that mailing list, so I'll comment here: 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. 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. 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. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe