[Haskell-cafe] Re: Memoization in Haskell?

2010-07-09 Thread Heinrich Apfelmus
Gregory Crosswhite wrote: You're correct in pointing out that f uses memoization inside of itself to cache the intermediate values that it commutes, but those values don't get shared between invocations of f; thus, if you call f with the same value of n several times then the memo table

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-09 Thread Edward Kmett
On Thu, Jul 8, 2010 at 5:30 PM, Angel de Vicente ang...@iac.es wrote: Hi, I'm going through the first chapters of the Real World Haskell book, so I'm still a complete newbie, but today I was hoping I could solve the following function in Haskell, for large numbers (n 108) f(n) =

[Haskell-cafe] Other transactional arrays?

2010-07-09 Thread Emil Melnicov
Currently, Haskell have transactional arrays in Control.Concurrent.STM.TArray implemented as Array i (TVar e) which is array of transactional variables. But what if I need to place an array into TVar itself? This is something like TVar (IOArray i e), but with ability to read/write array elements

Re: [Haskell-cafe] Other transactional arrays?

2010-07-09 Thread Felipe Lessa
On Fri, Jul 9, 2010 at 7:16 AM, Emil Melnicov emilm...@gmail.com wrote: writeTVector :: TVector a - Int - a - STM () writeTVector (TVector t#) (I# i#) x = stm $ \s1# -     case readTVar# t# s1#                    of { (# s2#, (MutableArray a#) #) -     case writeArray# a# i# x s2#            

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-09 Thread Angel de Vicente
Hi, thanks for all the replies. I'm off now to try all the suggestions... Cheers, Ángel de Vicente -- http://www.iac.es/galeria/angelv/ High Performance Computing Support PostDoc Instituto de Astrofísica de Canarias

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-09 Thread Daniel Fischer
On Friday 09 July 2010 01:03:48, Luke Palmer wrote: On Thu, Jul 8, 2010 at 4:23 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: On Friday 09 July 2010 00:10:24, Daniel Fischer wrote: You can also use a library (e.g. http://hackage.haskell.org/package/data- memocombinators) to do the

[Haskell-cafe] Something that kind of resembles OO

2010-07-09 Thread Michael Mossey
I notice in algebraic data defined with named fields, you can use the same name inside different constructors and then apply it to any data of that type. data Vehicle = Car { ident :: String, wheel :: Circle } | Plane { ident :: String, stick :: Line } f :: [Vehicle] - [String] f

Re: [Haskell-cafe] Something that kind of resembles OO

2010-07-09 Thread Ivan Lazar Miljenovic
Michael Mossey m...@alumni.caltech.edu writes: I notice in algebraic data defined with named fields, you can use the same name inside different constructors and then apply it to any data of that type. data Vehicle = Car { ident :: String, wheel :: Circle } | Plane { ident ::

Re: [Haskell-cafe] Talking to Java from Haskell?

2010-07-09 Thread Daniel Cook
A simpler solution might be Facebook's thrift [1] This is a very interesting solution. I'll investigate Thrift further, but it may wind up being what I do. Does anyone know how solid this code is in Haskell? the Java binary directly from Haskell using System.Process and friends, and rather

[Haskell-cafe] Float instance of Data.Bits

2010-07-09 Thread Sam Martin
Hi, Is there a particular reason Float, Double, etc do not have instances of Data.Bits in the standard libraries? I note the Haskell 2010 report doesn't include them either. In fact, I'm not actually sure how you'd implement the instance for floating point types without having some kind of

Re: [Haskell-cafe] Talking to Java from Haskell?

2010-07-09 Thread John Lato
From: Daniel Cook danielkc...@gmail.com Hi, Someone has written a large Java library (QuickFIX/J) which speaks a gnarled, ugly protocol (FIX).  There don't appear to be any FIX protocol libraries in Hackage.  I need my Haskell program to talk to a 3rd-party system that only speaks FIX.

Re: [Haskell-cafe] Other transactional arrays?

2010-07-09 Thread Emil Melnicov
On 9 July 2010, at 08:13 Felipe Lessa felipe.le...@gmail.com wrote: I guess the only problem lies with writeTVector. I don't know much about STM implementation details as well, but reading the code for writeTVector I can't see how it could be rollbacked. I.e., should something with

Re: [Haskell-cafe] Code Example and Haskell Patterns

2010-07-09 Thread Martijn van Steenbergen
On 7/8/10 21:36, Stephen Tetley wrote: Hello I suspect you will have to choose single examples for each of the patterns/ abstractions you are interested in. Doaitse Swierstra's library UU.Parsing is the originator or the Applicative style. Its latest incarnation is the library uu-parsinglib.

[Haskell-cafe] hs-dotnet with Mono?

2010-07-09 Thread Daniel Cook
Hi, Has anyone used hs-dotnet (http://haskell.forkio.com/dotnet/) with Mono on Linux? Cheers, - Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Float instance of Data.Bits

2010-07-09 Thread Ertugrul Soeylemez
Sam Martin sam.mar...@geomerics.com wrote: Is there a particular reason Float, Double, etc do not have instances of Data.Bits in the standard libraries? I note the Haskell 2010 report doesn't include them either. In fact, I'm not actually sure how you'd implement the instance for floating

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/8/10 22:25 , Alex Stangl wrote: 1. I.E. and e.g. should be followed by commas -- unless UK usage differs from US standards. (Page 3 and elsewhere, although FFI chapter I don't think I've ever seen them *followed* by commas. Preceded, always.

Re: [Haskell-cafe] Re: Float instance of Data.Bits

2010-07-09 Thread Serguey Zefirov
2010/7/9 Ertugrul Soeylemez e...@ertes.de: Sam Martin sam.mar...@geomerics.com wrote: Nobody would really need the operations (we have integer types and UArray Int Bool for bit manipulation), and they would most likely be very slow. They won't be slow using SSE2 or something. I can see where

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Steve Schafer
On Fri, 09 Jul 2010 10:07:06 -0400, you wrote: I don't think I've ever seen them *followed* by commas. Preceded, always. In American English, they're always followed by commas, and preceded by comma, semicolon, dash or left parenthesis, depending on the specific context. Examples from various

RE: [Haskell-cafe] Re: Float instance of Data.Bits

2010-07-09 Thread Sam Martin
Some operations wouldn't make much sense with Float, for instance the 'complement' function. What should it return? Also note that bit manipulation functions could cover only a small window of the value range. So it could happen that x .|. y = x, even though y is nonzero. Also rotation

Re: [Haskell-cafe] Re: Float instance of Data.Bits

2010-07-09 Thread Serguey Zefirov
2010/7/9 Sam Martin sam.mar...@geomerics.com: Some operations wouldn't make much sense with Float, for instance the 'complement' function.  What should it return?  Also note that bit manipulation functions could cover only a small window of the value range.  So it could happen that x .|. y =

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Kevin Quick
On Thu, 08 Jul 2010 09:48:34 -0700, Daniel Fischer daniel.is.fisc...@web.de wrote: On Thursday 08 July 2010 18:24:05, Ben Millwood wrote: On Thu, Jul 8, 2010 at 3:45 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: Well, I made the suggestion of emitting a warning on instance

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Sean Leather
On Fri, Jul 9, 2010 at 16:23, Steve Schafer wrote: On Fri, 09 Jul 2010 10:07:06 -0400, brandon s. allbery wrote: I don't think I've ever seen them *followed* by commas. Preceded, always. In American English, they're always followed by commas, and preceded by comma, semicolon, dash or left

Re: [Haskell-cafe] Code Example and Haskell Patterns

2010-07-09 Thread Stephen Tetley
Hi Martijn I think you are right there - the tech report I linked to does credit the interface to Niklas Röjemo, so I shouldn't have used the word originator (as you suggested popularised would have been better). Unfortunately the thesis doesn't seem available on the web so I can't see how much

FIX Protocol in Haskell (was Re: [Haskell-cafe] Talking to Java from Haskell?)

2010-07-09 Thread Daniel Cook
1)  How stable/defined is FIX? Not very. There are several protocol versions, various vendors have their own custom message types, there are service packs released fairly regularly updating the protocol for new message types, etc. 2)  How large of a subset of FIX do you use? I will be using

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-09 Thread Mike Dillon
begin Edward Kmett quotation: The result is considerably faster: *Main fastest_f 12380192300 67652175206 *Main fastest_f 12793129379123 120695231674999 I just thought I'd point out that running with these particular values on a machine with a 32 bit Int will cause your

Re: new haskell project (Was Re: [Haskell-cafe] Subtype polymorphism in Haskell)

2010-07-09 Thread Daniel Cook
Hi Simon, I'm interested in this as well (you might have seen my other posts about getting QuickFIX interfaced with Haskell). One question (Yitzchak raises a valid point): Why port QuantLib's structure rather than directly build an idiomatic Haskell quantitative finance library? Especially

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Steve Schafer
On Fri, 9 Jul 2010 17:14:31 +0200, you wrote: One of the nice things about English is that there is often never an always. See http://grammar.quickanddirtytips.com/ie-eg-oh-my.aspx for a discussion. Well, that page pretty much confirms what I said. In AMERICAN English, they're always followed by

Re: [Haskell-cafe] Code Example and Haskell Patterns

2010-07-09 Thread Malcolm Wallace
I think you are right there - the tech report I linked to does credit the interface to Niklas Röjemo, so I shouldn't have used the word originator (as you suggested popularised would have been better). Unfortunately the thesis doesn't seem available on the web so I can't see how much of the

Re: [Haskell-cafe] Re: Memoization in Haskell?

2010-07-09 Thread Gregory Crosswhite
That actually doesn't work as long as memo is an array, since then it has fixed size; you have to also make memo an infinitely large data (but lazy) structure so that it can hold results for arbitrary n. One option for doing this of course is to make memo be an infinite list, but a more

Re: [Haskell-cafe] Re: Float instance of Data.Bits

2010-07-09 Thread Nick Bowler
On 15:32 Fri 09 Jul , Sam Martin wrote: There are plenty of other examples of bit twiddling floats. Floats have a well defined bit representation (if a slightly complex one) so it's perfectly reasonable to be able to manipulate it. Note that the Haskell report does not require IEEE 754

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-09 Thread Edward Kmett
Very true. I was executing the large Int-based examples on a 64 bit machine. You can of course flip over to Integer on either 32 or 64 bit machines and alleviate the problem with undetected overflow. Of course that doesn't help with negative initial inputs ;) I do agree It is still probably a

Re: [Haskell-cafe] Re: Transformers versus monadLib versus...

2010-07-09 Thread Edward Kmett
On Thu, Jul 8, 2010 at 12:37 PM, Yitzchak Gale g...@sefer.org wrote: Hi Edward, Edward Kmett wrote: It looks like there is a fairly strong effort to fix most of the most egregious warts in the mtl. btw, does this overhaul include adding Applicative instances, perchance? They are

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Sean Leather
On Fri, Jul 9, 2010 at 18:35, Steve Schafer wrote: On Fri, 9 Jul 2010 17:14:31 +0200, Sean Leather wrote: One of the nice things about English is that there is often never an always. See http://grammar.quickanddirtytips.com/ie-eg-oh-my.aspx for a discussion. Well, that page pretty much

[Haskell-cafe] Haskellers in Cleveland

2010-07-09 Thread Jason Felice
I've just started a Cleveland Haskellers meetup, and for some reason I haven't thought to ask on this list yet. If there's anybody from the Greater Cleveland, OH area who is interested, please sign up! I hope to keep it small and informal. I've had good luck keeping it small so far. There's a

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Gregory Crosswhite
I don't know what the rule is, but I personally just replace i.e. with that is and e.g. with for example in my head, and then apply whatever punctuation makes sense with those substitutions. Cheers, Greg On 7/9/10 12:17 PM, Sean Leather wrote: On Fri, Jul 9, 2010 at 18:35, Steve Schafer

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Julian Fleischer
Hi, 8. [...] Saying 0**0 is undefined seems reasonable, but why 0**y? I agree on 0**y being 0 (not undefined), but why should 0**0 be undefined? x**0 := 1, by convention. Of course this is a still ongoing debate (regarding analysis of functions etc.), but the most usefull approach for /any/

Re: [Haskell-cafe] Re: Transformers versus monadLib versus...

2010-07-09 Thread Ross Paterson
On Fri, Jul 09, 2010 at 03:13:19PM -0400, Edward Kmett wrote: On Thu, Jul 8, 2010 at 12:37 PM, Yitzchak Gale g...@sefer.org wrote: btw, does this overhaul include adding Applicative instances, perchance? They are already part of monads-fd and would, I presume, come along for the

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Alex Stangl
On Sat, Jul 10, 2010 at 12:12:15AM +0200, Julian Fleischer wrote: 8. [...] Saying 0**0 is undefined seems reasonable, but why 0**y? I agree on 0**y being 0 (not undefined), but why should 0**0 be undefined? x**0 := 1, by convention. Of course this is a still ongoing debate (regarding

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread John Meacham
On Fri, Jul 09, 2010 at 06:07:04PM -0500, Alex Stangl wrote: I wasn't arguing that 0**0 *ought* to be undefined, but that it is a reasonable policy, since, as you point out, it's a matter of ongoing debate. What I don't understand is why for y /= 0, 0**y would be undefined. Maybe the

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Ivan Lazar Miljenovic
Brandon S Allbery KF8NH allb...@ece.cmu.edu writes: On 7/8/10 22:25 , Alex Stangl wrote: 1. I.E. and e.g. should be followed by commas -- unless UK usage differs from US standards. (Page 3 and elsewhere, although FFI chapter I don't think I've ever seen them *followed* by commas. Preceded,

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Ivan Lazar Miljenovic
Kevin Quick qu...@sparq.org writes: I would think that only mutually recursive default methods would require respecification and that there could be any number of default methods that were reasonable as is. Since it's probably quite difficult for the Haskell compiler to analytically detect

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Christopher Done
On 10 July 2010 01:22, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Brandon S Allbery KF8NH allb...@ece.cmu.edu writes: On 7/8/10 22:25 , Alex Stangl wrote: 1. I.E. and e.g. should be followed by commas -- unless UK usage differs from US standards. (Page 3 and elsewhere,

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Kevin Quick
On Fri, 09 Jul 2010 16:26:13 -0700, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Kevin Quick qu...@sparq.org writes: I would think that only mutually recursive default methods would require respecification and that there could be any number of default methods that were reasonable

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Edward Kmett
On Fri, Jul 9, 2010 at 8:46 PM, Kevin Quick qu...@sparq.org wrote: On Fri, 09 Jul 2010 16:26:13 -0700, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Kevin Quick qu...@sparq.org writes: I would think that only mutually recursive default methods would require respecification and

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Alexander Solla
On Jul 9, 2010, at 5:46 PM, Kevin Quick wrote: That's probably an interesting assertion that one of the category theorists around here could prove or disprove. ;-) It's not too hard. I don't like thinking about it in terms of category theory, though. It's easier to think about it in

Re: [Haskell-cafe] Functional dependencies and Peano numbers

2010-07-09 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: On 7/6/10 15:37 , Oscar Finnsson wrote: but can they also be on a form similar to a b c d e f g h| b c - d e f | b d g - h (i.e. d,e,f are decided by the b,c-combination while h is decided by the b,d,g-combination)? I think the answer to this is yes, but if

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread wren ng thornton
Julian Fleischer wrote: Hi, 8. [...] Saying 0**0 is undefined seems reasonable, but why 0**y? I agree on 0**y being 0 (not undefined), but why should 0**0 be undefined? x**0 := 1, by convention. I'm not familiar with that convention. So far as I'm aware, the x**0=1 vs 0**y=0 conflict

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread wren ng thornton
Christopher Done wrote: On 10 July 2010 01:22, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Brandon S Allbery KF8NH allb...@ece.cmu.edu writes: On 7/8/10 22:25 , Alex Stangl wrote: 1. I.E. and e.g. should be followed by commas -- unless UK usage differs from US standards. (Page 3

[Haskell-cafe] Fix plugins package.

2010-07-09 Thread Andy Stewart
Hi all, I want to use *plugins* package (http://hackage.haskell.org/package/plugins-1.4.1) Unfortunately, it looks broken. Anybody can fix it? Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Fix plugins package.

2010-07-09 Thread Ivan Lazar Miljenovic
Andy Stewart lazycat.mana...@gmail.com writes: Hi all, I want to use *plugins* package (http://hackage.haskell.org/package/plugins-1.4.1) Unfortunately, it looks broken. Anybody can fix it? Try putting an upper bound in the constraint for `base'; since there's no upper bound,

Re: [Haskell-cafe] bug in ghci ?

2010-07-09 Thread Kevin Quick
On Fri, 09 Jul 2010 18:57:34 -0700, Edward Kmett ekm...@gmail.com wrote: I hope the above demonstrate that there are at least some fairly reasonable (and, given your request, appropriately category theoretic!) examples where one would want the ability to specify that there is more than one

Re: [Haskell-cafe] Fix plugins package.

2010-07-09 Thread Andy Stewart
Hi Ivan, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Andy Stewart lazycat.mana...@gmail.com writes: Hi all, I want to use *plugins* package (http://hackage.haskell.org/package/plugins-1.4.1) Unfortunately, it looks broken. Anybody can fix it? Try putting an upper bound in

[Haskell-cafe] Re: Fix plugins package.

2010-07-09 Thread Andy Stewart
Andy Stewart lazycat.mana...@gmail.com writes: Hi Ivan, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Andy Stewart lazycat.mana...@gmail.com writes: Hi all, I want to use *plugins* package (http://hackage.haskell.org/package/plugins-1.4.1) Unfortunately, it looks broken.