Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Antoine Latter
2009/7/6 Matthias Görgens matthias.goerg...@googlemail.com: A Las Vegas algorithm, like randomized quicksort, uses a source of randomness to make certain decisions.  However its output is unaffected by the randomness.  So a function f :: RandomGen g = g - a - b implementing a

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Hector Guilarte
A few days ago I had to randomly choose and element of a list and continue execution, so here's what I did: I made a infinite list of Random numbers [Int] (Not IO [Int]) and I passed it around all the time in a Tuple and whenever I returned I also returned the list, so I would always have it

[Haskell-cafe] Where can I get GHC for Solaris?

2009-07-07 Thread John Ky
Hi, Anyone know where I can get the GHC compiler and libraries for Solaris?: SunOS sun05 5.9 Generic_118558-30 sun4u sparc SUNW,Sun-Fire-280R I tried to compile GHC myself and got the following error: $ ./configure --enable-hc-boot checking build system type... sparc-sun-solaris2.9 checking

[Haskell-cafe] Re: excercise - a completely lazy sorting algorithm

2009-07-07 Thread Heinrich Apfelmus
Petr Pudlak wrote: about a month ago, we were discussing sorting in Haskell with a friend. We realized a nice property of lazy merge-sort (which is AFAIK the implementation of Data.List.sort): Getting the first element of the sorted list actually requires O(n) time, not O(n * log n) as in

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Matthias Görgens
Dear Hector, Yes, I thought of a similar scheme. Say we want to implemented randomized quicksort. Passing a list of random numbers would destroy laziness and linearise the algorithm --- because the right recursion branch would need to know at least how many random numbers where consumed by the

Re: [Haskell-cafe] Re: excercise - a completely lazy sorting algorithm

2009-07-07 Thread Matthias Görgens
So, a tree like Matthias implements it is the way to go. Basically, it reifies the recursive calls of quicksort as a lazy data struture which can be evaluated piecemeal. Yes. I wonder if it is possible to use a standard (randomized quicksort) and employ some type class magic (like

Re: [Haskell-cafe] Haskell Platform on Ubuntu

2009-07-07 Thread Jochem Berndsen
Erik de Castro Lopo wrote: GHC in Ubuntu is a pain! The same is also currently true for GHC on Debian stable and testing. Debian unstable is also a bit broken. I only use Debian Stable, but I don't find it very hard to use. I just use the binary packages from www.haskell.org. That said,

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Ketil Malde
Matthias Görgens matthias.goerg...@googlemail.com writes: Yes, I thought of a similar scheme. Say we want to implemented randomized quicksort. Passing a list of random numbers would destroy laziness and linearise the algorithm --- because the right recursion branch would need to know at

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Matthias Görgens
What I wondered was, if one could hid the random plumbing in some data structure, like the state monad, but less linear. This problem cries for a State monad solution - but you don't need to do it yourself, there's already a Random monad defined for you. Yes, but I only need the random

Re: [Haskell-cafe] Where can I get GHC for Solaris?

2009-07-07 Thread gaius hammond
Quoting John Ky newho...@gmail.com: Hi, Anyone know where I can get the GHC compiler and libraries for Solaris?: I'm using this one: http://www.haskell.org/ghc/download_ghc_683.html#sparcsolaris Cheers, G -- - Visit Pipex Business:

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Max Rabkin
2009/7/7 Antoine Latter aslat...@gmail.com: If I were writing it as a library function, I would leave the function as you described and let the caller make the choice. Calling into randomIO in a library function is extremely dubious, as a second library could be getting and setting the random

[Haskell-cafe] Re: golf, predicate check function for MonadPlus

2009-07-07 Thread Jon Fairbairn
Dan Doel dan.d...@gmail.com writes: On Thursday 02 July 2009 6:36:09 am Jon Fairbairn wrote: check :: (MonadPlus m) = (a - Bool) - a - m a check p a | p a = return a | otherwise = mzero I've often noticed the need for a similar function in conjunction with unfoldr: -- This is

Re[2]: [Haskell-cafe] Re: Could FFI support pass-by-value of structs?

2009-07-07 Thread Bulat Ziganshin
Hello John, Tuesday, July 7, 2009, 5:48:10 AM, you wrote: you mean that on windows gcc, msvc and all other C compilers use the same ABI for passing and packing structs? Yes. If you think about it, otherwise it would be impossible to interface with system provided shared libraries (like

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Luke Palmer
2009/7/7 Matthias Görgens matthias.goerg...@googlemail.com What I wondered was, if one could hid the random plumbing in some data structure, like the state monad, but less linear. This problem cries for a State monad solution - but you don't need to do it yourself, there's already a

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Ketil Malde
Luke Palmer lrpal...@gmail.com writes: Random monad is a very natural choice for random cloud computations. Don't think of it as a state monad -- that's an implementation detail. You can think of a value of type Random a as a probability distribution of a's; and there are natural

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Ketil Malde
Ketil Malde ke...@malde.org writes: data Distribution = Uniform low high | Normal mu sigma | StudentT ... Of course, now that it occurs to me to check this, I notice Data.Random.Distribution does the same thing, only more generally, supporting more distributions, and no doubt with more

Re: [Haskell-cafe] Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Ketil Malde
Ketil Malde ke...@malde.org writes: sample :: Distribution - Random Double Sorry, that's not entirely accurate. Rather: sample :: RandomGen g = Distribution - Rand g Double -k -- If I haven't seen further, it is by standing in the footprints of giants

[Haskell-cafe] DHUG: meeting tomorrow (July 7th) in Utrecht

2009-07-07 Thread Chris Eidhof
Hi everyone, The Dutch HUG [1] will meet again tomorrow. This time we'll meet in Utrecht again, at the Stairway To Heaven. The meeting will start at 19h. The venue is a sometimes a bit noisy, but there's beer and nice big tables. If you want to hear everything about the Dutch HUG

[Haskell-cafe] Re: what about moving the record system to an addendum?

2009-07-07 Thread Duncan Coutts
On Mon, 2009-07-06 at 18:28 -0700, John Meacham wrote: Well, without a replacement, it seems odd to remove it. Also, Haskell currently doesn't _have_ a record syntax (I think it was always a misnomer to call it that) it has 'labeled fields'. None of the proposed record syntaxes fit the same

[Haskell-cafe] Re: Haskell Platform on Ubuntu

2009-07-07 Thread Simon Marlow
Karmic (9.10) will have GHC 6.10.3, possibly 6.10.4. http://bugs.launchpad.net/ubuntu/+source/ghc6/+bug/302149 Cheers, Simon On 06/07/2009 23:54, Stefan Roggensack wrote: Hello, I have uploaded the ghc package to my ppa: https://launchpad.net/~someone561/+archive/ppa But I don't work

Re: [Haskell-cafe] Re: Haskell Platform on Ubuntu

2009-07-07 Thread Matthias Görgens
Karmic (9.10) will have GHC 6.10.3, possibly 6.10.4. It currently spots 6.10.3, in the alpha release I run here. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANN: bloxorz clone

2009-07-07 Thread Patai Gergely
Will the darcs (or.. ) repository for the code be made public? I'm sure there are people in the community who'd like to contribute new levels, etc. I asked him, and he said that he plans to develop it further during the summer and make a public repo somewhere. We'll probably have to wait a few

Re: [Haskell-cafe] Optimizing Compiler for the ICFP 09 contest's VM

2009-07-07 Thread Matthias Brettschneider
Same over here, i would love to read about your discoveries :) -- Matthias On Sat, Jul 04, 2009 at 11:12:30PM +0200, minh thu wrote: 2009/7/4 Matthias Görgens matthias.goerg...@googlemail.com: If anyboby is interested, I can document my program and put it online somewhere. I also made

Re: [Haskell-cafe] Optimizing Compiler for the ICFP 09 contest's VM

2009-07-07 Thread Matthias Görgens
Since I have two readers now, I guess I'll have to start blogging. :o) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: what about moving the record system to an addendum?

2009-07-07 Thread Ravi Nanavati
2009/7/7 Duncan Coutts duncan.cou...@worc.ox.ac.uk: On Mon, 2009-07-06 at 18:28 -0700, John Meacham wrote: Well, without a replacement, it seems odd to remove it. Also, Haskell currently doesn't _have_ a record syntax (I think it was always a misnomer to call it that) it has 'labeled fields'.

[Haskell-cafe] Re: Implementing Las Vegas algorithms in Haskell

2009-07-07 Thread Heinrich Apfelmus
Luke Palmer wrote: What I wondered was, if one could hid the random plumbing in some data structure, like the state monad, but less linear. This problem cries for a State monad solution - but you don't need to do it yourself, there's already a Random monad defined for you. Yes, but I only

Re: [Haskell-cafe] lazy data structure for best-first search

2009-07-07 Thread Dan Piponi
On Wed, Jun 24, 2009 at 6:53 PM, Martin Hofmannmartin.hofm...@uni-bamberg.de wrote: I am looking for a good (preferably lazy) way to implement some kind of best-first search. So in fact, after one expansion, I need to fold over my complete search space, maybe updating other nodes and

[Haskell-cafe] ANNOUNCE: AspectAG 0.1.1

2009-07-07 Thread Marcos Viera
We are pleased to announce the availability of the package AspectAG, a library of strongly typed Attribute Grammars implemented using type-level programming. The package contains the code associated with our paper at ICFP 2009: @inproceedings{Viera:Attribute-Grammars, Author = {Marcos Viera

[Haskell-cafe] Re: what about moving the record system to an addendum?

2009-07-07 Thread Iavor Diatchki
Hello, I do not think that we should remove the current record/named fields syntax, at least for the moment. I use it a lot, and I do not want to add extra pragmas or extensions to my cabal file. In fact, one of the purposes of Haskell', the way I understand it, is exactly to just choose a

[Haskell-cafe] Re: what about moving the record system to an addendum?

2009-07-07 Thread John Meacham
On Tue, Jul 07, 2009 at 10:28:11AM -0400, Ravi Nanavati wrote: 2. Once deprecated, people will be encouraged to not depend on the traditional record syntax where the cost of avoiding it is small (I'm thinking of situations like the mtl-accessors / run functions where the traditional syntax is

[Haskell-cafe] Adaptive transactions

2009-07-07 Thread Ryan Ingram
It seems to me that the Adaptive framework[1][2] is well-suited to STM transactions. Consider this snippet: expensive_transaction :: STM Int -- does a bunch of work example :: TVar Int - STM Int example t = (+) $ readTVar t * expensive_transaction If the TVar passed to example is rapidly

Re: [Haskell-cafe] Re: Haskell Platform on Ubuntu

2009-07-07 Thread Erik de Castro Lopo
Simon Marlow wrote: Karmic (9.10) will have GHC 6.10.3, possibly 6.10.4. http://bugs.launchpad.net/ubuntu/+source/ghc6/+bug/302149 Unfortunately thats only half the story. The GHC 6.10.3 that is going into Kamic is the one from Debian Unstable. It is important to note here that beyond doing

[Haskell-cafe] Removing polymorphism from type classes (viz. Functor)

2009-07-07 Thread George Pollard
Ok, so I have a small idea I'm trying to work on; call it a Prelude-rewrite if you want. For this I want to be able to have the hierarchy Functor → Applicative → Monad. For Functor, I would like to be able to implement it for a wider variety of types, as there are types which have aren't

Re: [Haskell-cafe] Re: Haskell Platform on Ubuntu

2009-07-07 Thread George Pollard
2009/7/7 Matthias Görgens matthias.goerg...@googlemail.com: Karmic (9.10) will have GHC 6.10.3, possibly 6.10.4. It currently spots 6.10.3, in the alpha release I run here. A major problem is that the libraries are still for 6.8.2, so you cannot install the required libs to install cabal. Grr.

Re: [Haskell-cafe] lazy data structure for best-first search

2009-07-07 Thread Martin Hofmann
Thanks Dan, that gave me some new input I can continue working on. Cheers, Martin Am Dienstag, den 07.07.2009, 10:18 -0700 schrieb Dan Piponi: On Wed, Jun 24, 2009 at 6:53 PM, Martin Hofmannmartin.hofm...@uni-bamberg.de wrote: I am looking for a good (preferably lazy) way to implement some

Re: [Haskell-cafe] simple state monad exercises? (besides labeling trees)

2009-07-07 Thread John Meacham
On Mon, Jul 06, 2009 at 12:54:54PM -0400, Thomas Hartman wrote: Can someone give some simple common scenarios where the state monad is useful, besides labeling trees? Implementing the Union-Find data structure[1] for unification based type inference. As far as I know, no good alternative exists

Re: [Haskell-cafe] following up on space leak

2009-07-07 Thread George Pollard
I believe there might be an elegant solution for this using the `Last` monoid ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe