Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-31 Thread Krasimir Angelov
Hi again, I was silent for some time but in this time I created QuickCheck tests for Data.Tree.Zipper which achieve 100% coverage with HPC. I also created a ticket for it: Ticket #2324 http://hackage.haskell.org/trac/ghc/ticket/2324 The attached file is the current implementation and it

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-24 Thread Iavor Diatchki
Hello, I think that the modified API (no state monad, and using Maybe) is quite nice! I implemented a version of the the suggested API using a slightly different data structure, which makes the code a bit simpler, I think. I put the code in the Haskell wiki:

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Krasimir Angelov
Aha. I see the point. The current design was influenced from some other implementation that I spot somewhere in the net. I will change it but this reminds me of another problem. Most movement functions raise error if they can't do the movement. This is convenient if you somehow know that the

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Jules Bean
Krasimir Angelov wrote: The monads design is used in Data.Map i.e. lookup :: (Monad m, Ord k) = k - Map k a - m a which is widely considered a poor design decision and a wart on Data.Map. :-) Seriously, if you don't return a useful error message, then Maybe is as good as it gets, why not

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Miguel Mitrofanov
I think that MonadZero m = ... is better than just Maybe. If you can have more general solution for free, why fight it? On 23 May 2008, at 14:55, Jules Bean wrote: Krasimir Angelov wrote: The monads design is used in Data.Map i.e. lookup :: (Monad m, Ord k) = k - Map k a - m a which is

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Luke Palmer
On Fri, May 23, 2008 at 10:55 AM, Jules Bean [EMAIL PROTECTED] wrote: Krasimir Angelov wrote: The monads design is used in Data.Map i.e. lookup :: (Monad m, Ord k) = k - Map k a - m a which is widely considered a poor design decision and a wart on Data.Map. It is? Can you point to

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Brandon S. Allbery KF8NH
On 2008 May 23, at 13:34, Luke Palmer wrote: On Fri, May 23, 2008 at 10:55 AM, Jules Bean [EMAIL PROTECTED] wrote: Krasimir Angelov wrote: The monads design is used in Data.Map i.e. lookup :: (Monad m, Ord k) = k - Map k a - m a which is widely considered a poor design decision and a

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-23 Thread Don Stewart
Using 'monad' here makes it easier to make a mistake with the code, as it permits new kinds of unexpected failure. This is Haskell, we should use Maybe. And users that want it can lift Maybe a - m a -- Don (-1) for new uses of fail in place of Nothing. kr.angelov: The monads design is used

[Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-22 Thread Krasimir Angelov
Hello Guys, We have Data.Tree in the standard libraries for a long time but for some reason we still don't have standard implementation for Zipper. I wrote recently one implementation for Yi but there are many other versions hanging around. At least I know for some. I propose to add one in the

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-22 Thread Conal Elliott
Hi Krasimir, I had a long exchange with chessguy about this interface, suggesting a significant change in style, simplifying the type. (Incidentally, the change removed the State and hence mtl dependence.) The conversation is on http://tunes.org/~nef/logs/haskell/08.05.17, starting with

Re: [Haskell-cafe] Data.Tree.Zipper in the standard libraries

2008-05-22 Thread Conal Elliott
* Every definition of tp I meant of type, forgetting that my emacs abbrevs don't expand in gmail. On Thu, May 22, 2008 at 2:13 PM, Conal Elliott [EMAIL PROTECTED] wrote: Hi Krasimir, I had a long exchange with chessguy about this interface, suggesting a significant change in style,