[Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Michael Snoyman
Hi all, I think this is a well-known issue: it seems that there is no character decoding performed on the values returned from the functions in System.Directory (getDirectoryContents specifically). I could manually do something like (utf8Decode . S8.pack), but that presumes that the character

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Jason Dagit
On Tue, Mar 29, 2011 at 11:52 PM, Michael Snoyman mich...@snoyman.comwrote: Hi all, I think this is a well-known issue: it seems that there is no character decoding performed on the values returned from the functions in System.Directory (getDirectoryContents specifically). I could manually

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Tako Schotanus
On Wed, Mar 30, 2011 at 09:26, Jason Dagit dag...@gmail.com wrote: On Tue, Mar 29, 2011 at 11:52 PM, Michael Snoyman mich...@snoyman.comwrote: Hi all, I think this is a well-known issue: it seems that there is no character decoding performed on the values returned from the functions in

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Max Bolingbroke
On 30 March 2011 07:52, Michael Snoyman mich...@snoyman.com wrote: I could manually do something like (utf8Decode . S8.pack), but that presumes that the character encoding on the system in question is UTF8. So two questions: Funnily enough I have been thinking about this quite hard recently,

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Alistair Bayley
On 30 March 2011 20:53, Max Bolingbroke batterseapo...@hotmail.com wrote: On 30 March 2011 07:52, Michael Snoyman mich...@snoyman.com wrote: I could manually do something like (utf8Decode . S8.pack), but that presumes that the character encoding on the system in question is UTF8. So two

Re: [Haskell-cafe] object oriented technique

2011-03-30 Thread Gábor Lehel
On Wed, Mar 30, 2011 at 6:52 AM, Tad Doxsee tad.dox...@gmail.com wrote: Greg, Thanks for your help.  Is there any significant difference between using existential quantification data ShapeD = forall s. ShapeC = ShapeD s versus a GADT data ShapeD  where  ShapeD :: ShapeC s = s - ShapeD

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Tako Schotanus
On Wed, Mar 30, 2011 at 11:01, Alistair Bayley alist...@abayley.org wrote: On 30 March 2011 20:53, Max Bolingbroke batterseapo...@hotmail.comwrote: On 30 March 2011 07:52, Michael Snoyman mich...@snoyman.com wrote: I could manually do something like (utf8Decode . S8.pack), but that

Re: [Haskell-cafe] object oriented technique

2011-03-30 Thread Tillmann Rendel
Hi, Steffen Schuldenzucker wrote: data Shape = Shape { draw :: String copyTo :: Double - Double - Shape } Tad Doxsee wrote: Suppose that the shape class has 100 methods and that 1000 fully evaluated shapes are placed in a list. The above solution would store the full method table

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Max Bolingbroke
On 30 March 2011 10:20, Tako Schotanus t...@codejive.org wrote: http://www.haskell.org/pipermail/libraries/2009-August/012493.html I took from this discussion that FilePath really should be a pair of the actual filename ByteString, and the printable String (decoded from the ByteString, with

Re: [Haskell-cafe] object oriented technique

2011-03-30 Thread Gregory Collins
On Wed, Mar 30, 2011 at 6:52 AM, Tad Doxsee tad.dox...@gmail.com wrote: Greg, Thanks for your help.  Is there any significant difference between using existential quantification data ShapeD = forall s. ShapeC = ShapeD s versus a GADT data ShapeD  where  ShapeD :: ShapeC s = s - ShapeD

[Haskell-cafe] Two Haskell Platforms on single machine.

2011-03-30 Thread Serguey Zefirov
I had to use two Haskell Platforms at once in the Windows environment. We use Haskell Platform 2011.1 as our main build platform. It provide real benefits for code with GADTs so we ported most of our code there. Right now we cannot switch back or it would be quite a regress. We also have some

Re: [Haskell-cafe] Dynamically linked executables

2011-03-30 Thread Edward Amsden
I'm pretty sure it's not possible under OS X, and just as sure that it would be really nice, because some OS X libraries I'd like to link to (JACK OS X in particular), don't provide static libraries. On Mon, Mar 28, 2011 at 1:14 PM, Anakim Border akbor...@gmail.com wrote: Hi, I'm trying to

[Haskell-cafe] Regarding two platforms build error.

2011-03-30 Thread Serguey Zefirov
Haskell Platform 2010.1 with ghc 6.12.1 worked quite well. Problem solved. ;) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] how to optmize this code?

2011-03-30 Thread Gilberto Garcia
Hi Haskellers, I was solving this problem from project euler to study haskell. I came up whit the following solution and I was wondering if there is a more optimized and concise solution. fkSum :: Int - [Int] - Int fkSum a [] = 0 fkSum a (b) = foldl (+) 0 (filter (\x - isMultiple x b) [1..a])

Re: [Haskell-cafe] how to optmize this code?

2011-03-30 Thread Daniel Fischer
On Wednesday 30 March 2011 16:39:49, Gilberto Garcia wrote: Hi Haskellers, I was solving this problem from project euler to study haskell. I came up whit the following solution and I was wondering if there is a more optimized and concise solution. Yes. There's a constant-time formula for

Re: [Haskell-cafe] CURL and upload a file

2011-03-30 Thread oliver mueller
i had a very similar problem recently. thanks for posting the curl- based solution. if you are interested in a haskell-only version (at least without curl), check out https://github.com/marcmo/andSync/blob/master/test/Upload.hs the most of the code came from cabal since they have code to upload

Re: [Haskell-cafe] how to optmize this code?

2011-03-30 Thread Yves Parès
If I'm not wrong : sum [1..n] = (n² + n)/2 2011/3/30 Daniel Fischer daniel.is.fisc...@googlemail.com On Wednesday 30 March 2011 16:39:49, Gilberto Garcia wrote: Hi Haskellers, I was solving this problem from project euler to study haskell. I came up whit the following solution and I

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Michael Snoyman
On Wed, Mar 30, 2011 at 9:26 AM, Jason Dagit dag...@gmail.com wrote: On Tue, Mar 29, 2011 at 11:52 PM, Michael Snoyman mich...@snoyman.com wrote: Hi all, I think this is a well-known issue: it seems that there is no character decoding performed on the values returned from the functions

[Haskell-cafe] Computational Physics in Haskell

2011-03-30 Thread Azeem -ul-Hasan
I started learning Haskell a little while ago. Although I am a novice I am still in love with it. I am physics major and primarily interested in Theoretical Physics and would like to use Haskell in this area. So, I just know to what has been done in this area, are there any libraries for

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Bas van Dijk
On 30 March 2011 18:07, Michael Snoyman mich...@snoyman.com wrote: On Wed, Mar 30, 2011 at 9:26 AM, Jason Dagit dag...@gmail.com wrote: On Tue, Mar 29, 2011 at 11:52 PM, Michael Snoyman mich...@snoyman.com wrote: Hi all, I think this is a well-known issue: it seems that there is no

[Haskell-cafe] [ghci] unknown symbol in base-unicode-symbols-0.2.1.2 ...

2011-03-30 Thread John Obbele
Hi everyone ! I'm having a problem in GHCi when loading modules relying on the base-unicode-symbols package. My prompt gives me the following message: ghci $ GHCi, version 7.0.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp

[Haskell-cafe] ArrowLoop and streamprocessors

2011-03-30 Thread Mathijs Kwik
Hi all, I'm playing around a bit with arrows (more specifically, something like a CPS style streamprocessor as described in Generalising Monads to Arrows by John Hughes). A part of my program takes inputs/signals from 2 sources. The sources don't produce output at the same rate, and this part is

Re: [Haskell-cafe] [ghci] unknown symbol in base-unicode-symbols-0.2.1.2 ...

2011-03-30 Thread John Obbele
On Wed, Mar 30, 2011 at 10:37:47PM +0200, John Obbele wrote: I'm having a problem in GHCi when loading modules relying on the base-unicode-symbols package. My prompt gives me the following message: ghci $ Loading package base-unicode-symbols-0.2.1.2 ... linking ... interactive:

Re: [Haskell-cafe] ArrowLoop and streamprocessors

2011-03-30 Thread Patai Gergely
So loop really doesn't seem to help here, but I couldn't find another way either to feed outputs back into the system. What I need is: Either A B ~ Either C B - A ~ C Does such a thing exist? At this point you don't really have enough structure to define such a feedback loop. Since you have

[Haskell-cafe] Accessing to a Haskell type in C

2011-03-30 Thread Yves Parès
Hello, To access a haskell type from C code, do we have to make this type instance of Storable (and so to also define an homomorph structure on the C side), or does FFI specifies some C function to enable C code to access the fields, or even some GHC-specific functions? (Even if I'd prefer a

Re: [Haskell-cafe] Accessing to a Haskell type in C

2011-03-30 Thread Antoine Latter
On Wed, Mar 30, 2011 at 5:27 PM, Yves Parès limestr...@gmail.com wrote: Hello, To access a haskell type from C code, do we have to make this type instance of Storable (and so to also define an homomorph structure on the C side), or does FFI specifies some C function to enable C code to access

Re: [Haskell-cafe] Computational Physics in Haskell

2011-03-30 Thread KC
I'd also like to know of any Haskell programs for theoretical/computational physics. H! Maybe converting such programs to Haskell. On Wed, Mar 30, 2011 at 11:23 AM, Azeem -ul-Hasan aze...@live.com wrote: I started learning Haskell a little while ago. Although I am a novice I am still in

Re: [Haskell-cafe] [ghci] unknown symbol in base-unicode-symbols-0.2.1.2 ...

2011-03-30 Thread Roel van Dijk
I can reproduce the problem on my system with GHC-7.0.3. The flag old-base is meant for base libraries before 3.0.3.1 which didn't export a Control.Category module. It looks like I accidentally inverted the logic of the flag. What is weird is that is still builds okay on my system. I would expect

[Haskell-cafe] pool, persistent, persistent-sqlite: Space leak

2011-03-30 Thread Ertugrul Soeylemez
Hello Michael, hello fellow Haskellers, there seems to be a space leak in either 'pool', 'persistent' or 'persistent-sqlite'. From the behaviour I suspect the bug to be in 'pool'. When I run a transaction in an infinite loop, my program keeps eating more and more memory, even if the transaction

[Haskell-cafe] Haskell Weekly News: Issue 175

2011-03-30 Thread Daniel Santa Cruz
Welcome to issue 175 of the HWN, a newsletter covering developments in the [1]Haskell community. This release covers the week of March 20 - 26. You can find the HTML version at: http://bit.ly/gs9Rr8 Announcements Wren Ng Thornton [2]announced the release of unix-bytestring:

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread John Millikin
On Wednesday, March 30, 2011 12:18:48 PM UTC-7, Bas van Dijk wrote: It would also be great to have a package which combines the proper encoding/decoding of filepaths of the system-filepath package with the type-safety of the pathtype package: http://hackage.haskell.org/package/pathtype Does

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread John Millikin
On Wednesday, March 30, 2011 9:07:45 AM UTC-7, Michael Snoyman wrote: Thanks to you (and everyone else) for the informative responses. For now, I've simply hard-coded in UTF-8 encoding for all non-Windows systems. I'm not sure how this will play with OSes besides Windows and Linux (especially

Re: [Haskell-cafe] how to optmize this code?

2011-03-30 Thread Felipe Almeida Lessa
On Wed, Mar 30, 2011 at 2:39 PM, Gilberto Garcia giba@gmail.com wrote: fkSum :: Int - [Int] - Int fkSum a [] = 0 fkSum a (b) = foldl (+) 0 (filter (\x - isMultiple x b) [1..a]) Daniel Fischer and Yves Parès gave you good suggestions about implementing a different, better algorithm for you

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread Ivan Lazar Miljenovic
On 31 March 2011 14:51, John Millikin jmilli...@gmail.com wrote: Linux, OSX, and (probably?) FreeBSD use UTF8. For Linux, doesn't it depend upon the locale rather than forcing UTF-8? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com

Re: [Haskell-cafe] how to optmize this code?

2011-03-30 Thread Gilberto Garcia
Thank you very much for the suggestions. giba ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Encoding-aware System.Directory functions

2011-03-30 Thread John Millikin
On Wed, Mar 30, 2011 at 21:07, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 31 March 2011 14:51, John Millikin jmilli...@gmail.com wrote: Linux, OSX, and (probably?) FreeBSD use UTF8. For Linux, doesn't it depend upon the locale rather than forcing UTF-8? In theory, yes.

Re: [Haskell-cafe] Computational Physics in Haskell

2011-03-30 Thread Mihai Maruseac
On Thu, Mar 31, 2011 at 1:50 AM, KC kc1...@gmail.com wrote: I'd also like to know of any Haskell programs for theoretical/computational physics. H! Maybe converting such programs to Haskell. On Wed, Mar 30, 2011 at 11:23 AM, Azeem -ul-Hasan aze...@live.com wrote: I started learning

Re: [Haskell-cafe] Computational Physics in Haskell

2011-03-30 Thread David Sorokin
31.03.2011 08:57, Mihai Maruseac пишет: On Thu, Mar 31, 2011 at 1:50 AM, KCkc1...@gmail.com wrote: I'd also like to know of any Haskell programs for theoretical/computational physics. H! Maybe converting such programs to Haskell. On Wed, Mar 30, 2011 at 11:23 AM, Azeem