[Haskell-cafe] Subject: ANNOUNCE: grid-3.0.1 (tile maps for board games or maths)

2013-02-18 Thread Amy de Buitléir
I'm happy to announce a new major release of the grid package: http://hackage.haskell.org/package/grid https://github.com/mhwombat/grid/wiki (wiki) WHAT'S NEW: Functions for reporting the boundary and centre of bounded grid have been added, along with some miscellaneous new utility

Re: [Haskell-cafe] Subject: ANNOUNCE: grid-3.0.1 (tile maps for board games or maths)

2013-02-18 Thread Twan van Laarhoven
On 18/02/13 13:41, Amy de Buitléir wrote: I'm happy to announce a new major release of the grid package: http://hackage.haskell.org/package/grid https://github.com/mhwombat/grid/wiki (wiki) After taking a peek at the documentation: have you considered removing the size function

[Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). - `foldl` is also unsuitable, because it

[Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). - `foldl` is also unsuitable, because it

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Andres Löh
Hi. while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). What is the problem with the following definition

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* Petr Pudlák petr@gmail.com [2013-02-18 17:10:26+0100] Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* Roman Cheplyaka r...@ro-che.info [2013-02-18 18:28:47+0200] * Petr Pudlák petr@gmail.com [2013-02-18 17:10:26+0100] Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Petr Pudlák
Thanks Roman and Andres for the tip. I knew the trick with accumulating a function, but I had never imagined it could work so efficiently. I thought the problem with using foldr would be that the function would be neither tail recursive nor efficient and so I hadn't even tried. Apparently that was

[Haskell-cafe] layers: A prototypical 2d platform game

2013-02-18 Thread Daniel Trstenjak
Hi all, also if there's not that much to see and only a few minutes of gameplay, but after spending quite a few hours writing it, getting a feeling for Haskell and it's usage, perhaps it's in some way useful for someone, even if just for a few minutes of distraction.

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Niklas Hambüchen
On 18/02/13 16:10, Petr Pudlák wrote: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and it's not tail recursive). It is common misconception that foldr processes the list from the right. foldr brackets from the right, but this

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-18 Thread Jason Dagit
On Sun, Feb 17, 2013 at 8:53 PM, Cale Gibbard cgibb...@gmail.com wrote: On 17 February 2013 18:03, Jan Stolarek jan.stola...@p.lodz.pl wrote: ... This changes would be quite invasive and code wouldn't be compatible with the lambdabot repo on haskell.org. So before I start making any of

[Haskell-cafe] ~ operator ?

2013-02-18 Thread briand
Hi all, I was creating bigger uncurries which I am simply extending from an existing uncurry I found some where, e.g. uncurry4 :: (a - b - c - d - e) - ((a, b, c, d) - e) uncurry4 f ~(a,b,c,d) = f a b c d when I realized, what's the ~ for ? I've only been able to find a partial explanation

Re: [Haskell-cafe] ~ operator ?

2013-02-18 Thread Patrick Palka
The difference the ~ makes in this case is that `uncurry4 (\_ _ _ _ - ()) undefined` evaluates to `()` instead of bottom. The ~ is called an irrefutable pattern, and it helps make code that pattern matches on constructors more lazy. This seems like a good explanation of the subject:

[Haskell-cafe] Aeson + MongoDB, how to effortlessly store and retrieve json?

2013-02-18 Thread Alfredo Di Napoli
Good evening guys, suppose I write a very simple parser using Aeson with these types and ToJSON / FromJSON instances: https://github.com/cakesolutions/the-pragmatic-haskeller/blob/master/01-json/Pragmatic/Types.hs

Re: [Haskell-cafe] ~ operator ?

2013-02-18 Thread briand
On Mon, 18 Feb 2013 19:13:13 + Mateusz Kowalczyk fuuze...@fuuzetsu.co.uk wrote: On 18/02/13 19:02, bri...@aracnet.com wrote: Hi all, I was creating bigger uncurries which I am simply extending from an existing uncurry I found some where, e.g. uncurry4 :: (a - b - c - d - e) -

Re: [Haskell-cafe] Aeson + MongoDB, how to effortlessly store and retrieve json?

2013-02-18 Thread Niklas Hambüchen
Not sure if this is helpful, but have a look at aesonbson: https://github.com/nh2/aesonbson/blob/master/Data/AesonBson.hs It can convert aeson to bson and the other way around, so you can easily convert 'Object's to 'Document's. Is that what you are looking for? On 18/02/13 21:37, Alfredo Di

Re: [Haskell-cafe] FunPtr to C function with #arguments determined atruntime?

2013-02-18 Thread Daniel Peebles
Considering that the GHC FFI is already built on libffi (I'm reasonably sure) it seems unnecessary for the Hackage library to depend on an external version. Is it not already getting linked in? On Sun, Feb 17, 2013 at 6:53 PM, Ryan Newton rrnew...@gmail.com wrote: The scenario is pretty

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread oleg
As others have pointed out, _in principle_, foldr is not at all deficient. We can, for example, express foldl via foldr. Moreover, we can express head, tail, take, drop and even zipWith through foldr. That is, the entire list processing library can be written in terms of foldr:

Re: [Haskell-cafe] Aeson + MongoDB, how to effortlessly store and retrieve json?

2013-02-18 Thread Alfredo Di Napoli
Hi Niklas, From a quick look it seems to be suitable for my task. I'll have a look ASAP and I'll keep you posted. Many thanks! Alfredo Di Napoli On 19/feb/2013, at 00:32, Niklas Hambüchen m...@nh2.me wrote: Not sure if this is helpful, but have a look at aesonbson:

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* o...@okmij.org o...@okmij.org [2013-02-19 06:27:10-] As others have pointed out, _in principle_, foldr is not at all deficient. We can, for example, express foldl via foldr. Moreover, we can express head, tail, take, drop and even zipWith through foldr. That is, the entire list