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

2008-05-23 Thread Krasimir Angelov
An updated Zipper version is uploaded here: http://www.haskell.org/haskellwiki/User_talk:Kr.angelov It doesn't use State monad anymore and it returns Maybe. This seems to be the common preference, is it? Feel free to vote against. Should we change Data.Map also? There is another proposal for chan

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

2008-05-23 Thread ajb
G'day all. Quoting Don Stewart <[EMAIL PROTECTED]>: This is Haskell, we should use Maybe. This is Haskell, more abstract is good. I do agree, though, that Monad is arguably the wrong abstraction. Something like this would arguably be better: class (Functor f) => Fail f where return ::

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-23 Thread Olivier Boudry
On Fri, May 23, 2008 at 5:17 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > > Maybe I don't like to read backwards. ;-) > > >>> (from Control.arrow) is like flip (.) > > That's something I considered. I like the `|>` operator found in F# (I hope it's not a curse word on this list) which is equiva

Re: [Haskell-cafe] gtk2hs linking problems

2008-05-23 Thread Bertram Felgenhauer
Nabil Alsharif wrote: > I downloaded the gtk2hs 0.9.12.1 tarball and did the standard configure, > make, make install but when I go to compile a test program I get a bunch > of errors that look like: How did you compile the program? [snip link errors] This usually indicates a missing --make or

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Henning Thielemann
On Fri, 23 May 2008, Ketil Malde wrote: Henning Thielemann <[EMAIL PROTECTED]> writes: An even more advanced tool could show differences between two Core listings [..] In this special example, actually simple 'diff' spotted the critical difference I would suggest Emacs's ediff for this, it

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-23 Thread Olivier Boudry
On Fri, May 23, 2008 at 2:20 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > > The big benefit I got from using the State Monad was that I was able to > reorder the functions > by just copy/pasting the function name from one > place to another. > > I don't understand... why do you need state to do

RE: [Haskell-cafe] force inlining in GHC (fwd)

2008-05-23 Thread Henning Thielemann
maybe also of interest in the ghc-core thread -- Forwarded message -- Date: Fri, 23 May 2008 21:21:03 +0200 (CEST) From: Henning Thielemann <[EMAIL PROTECTED]> To: Simon Peyton-Jones <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: RE: [Haskell-cafe] force inlining in GHC On

[Haskell-cafe] gtk2hs linking problems

2008-05-23 Thread Nabil Alsharif
I downloaded the gtk2hs 0.9.12.1 tarball and did the standard configure, make, make install but when I go to compile a test program I get a bunch of errors that look like: compilation IS NOT required [..snip..] (.data+0x38): undefined reference to `gtkzm0zi9zi12zi1_GraphicsziUIziGtkziTypes_zdf548_

Re: Re[2]: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Don Stewart
duncan.coutts: > > On Fri, 2008-05-23 at 21:24 +0200, Henning Thielemann wrote: > > On Fri, 23 May 2008, Bulat Ziganshin wrote: > > > > > Hello Henning, > > > > > > Friday, May 23, 2008, 8:31:24 PM, you wrote: > > > > > >> would guarantee speed in every case. Or I can SPECIALISE the function, > >

[Haskell-cafe] strange cabal error

2008-05-23 Thread John Lato
Hello, I recently ran into a strange cabal error. When trying to configure a package (leksah 0.1.1) I get the following error: MacBook-Pro:leksah-0.1.1 jwl$ runhaskell Setup.lhs configure Configuring leksah-0.1.1... Setup.lhs: ghc version >=6.2 is required but the version of /usr/local/bin/ghc c

Re: Re[2]: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Duncan Coutts
On Fri, 2008-05-23 at 21:24 +0200, Henning Thielemann wrote: > On Fri, 23 May 2008, Bulat Ziganshin wrote: > > > Hello Henning, > > > > Friday, May 23, 2008, 8:31:24 PM, you wrote: > > > >> would guarantee speed in every case. Or I can SPECIALISE the function, > >> then the function will only be

Re[2]: [Haskell-cafe] problems with derive/TH

2008-05-23 Thread Bulat Ziganshin
Hello Thomas, Friday, May 23, 2008, 11:29:44 PM, you wrote: > darcs: Pushing to http URLs is not supported. of course. http is read-only media :) you have to send patches via email (in most cases). read darcs docs -- Best regards, Bulatmailto:[EMAIL PROTECTED] _

Re: [Haskell-cafe] problems with derive/TH

2008-05-23 Thread Thomas Hartman
adding OPTIONS -XStandaloneDeriving made no difference The following patch fixed the problem. (Well, at least the mud program compiles. I haven't actually tried using it yet.) [EMAIL PROTECTED]:~/mud>darcs whatsnew { hunk ./World.hs 50 -deriving Eq +-- deriving Eq + +instance Eq (World TV

Re[2]: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Henning Thielemann
On Fri, 23 May 2008, Bulat Ziganshin wrote: Hello Henning, Friday, May 23, 2008, 8:31:24 PM, you wrote: would guarantee speed in every case. Or I can SPECIALISE the function, then the function will only be called, but with polymorphism overhead eliminated. This would only work for a restrict

Re: [Haskell-cafe] Bug in parallel GHC runtime?

2008-05-23 Thread Don Stewart
Hi, Thanks for the bug report. This should be filed on the GHC bug tracker, http://hackage.haskell.org/trac/ghc/newticket?type=bug And I've forwarded it to the glasgow-haskell-bugs mailing list. kolar: > Hello all, > > The attached file was compiled by the following command: > > ghc -O2

[Haskell-cafe] newbie: maintaining relationships

2008-05-23 Thread geoffrey
I am learning haskell and i need some advice about writing functional-style code. Give the following code below, my question is - how do i setup a dependency of User on Common? Obviously what i have there is wrong, because a change in common (i know it's actually immutable) is not reflected in th

[Haskell-cafe] Re: throwDynIO ?

2008-05-23 Thread Aleksey Nogin
Back in October'06 Carlos Pita sent a message to this list: Currently I'm trying to grasp haskell exception handling and although I find it mostly clear I'm a bit confused regarding the lack of a throwDynIO action "paralelling" throwIO, as there are dynamic variants for the other throw functions

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

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

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 p

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Don Stewart
igloo: > On Fri, May 23, 2008 at 05:54:36PM +0200, Henning Thielemann wrote: > > > > An even more advanced tool could show differences between two Core > > listings. > > That would be great. In the meantime, from GHC 6.10, > -ddump-simpl -dsuppress-uniques > can be good enough to get by (it

Re[2]: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Bulat Ziganshin
Hello Henning, Friday, May 23, 2008, 8:31:24 PM, you wrote: > would guarantee speed in every case. Or I can SPECIALISE the function, > then the function will only be called, but with polymorphism overhead > eliminated. This would only work for a restricted range of types. I'd like > to have a pr

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Don Stewart
lemming: > > On Fri, 23 May 2008, Henning Thielemann wrote: > > >An even more advanced tool could show differences between two Core > >listings. Say I have a program which runs too slow. But if I change a > >small detail it runs significantly faster - I want to know, how did my > >change in th

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Ian Lynagh
On Fri, May 23, 2008 at 05:54:36PM +0200, Henning Thielemann wrote: > > An even more advanced tool could show differences between two Core > listings. That would be great. In the meantime, from GHC 6.10, -ddump-simpl -dsuppress-uniques can be good enough to get by (it means you don't get di

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Henning Thielemann
On Fri, 23 May 2008, Henning Thielemann wrote: An even more advanced tool could show differences between two Core listings. Say I have a program which runs too slow. But if I change a small detail it runs significantly faster - I want to know, how did my change in the Haskell file modified th

Re: [Haskell-cafe] Trying to write a very simple HTTP Client

2008-05-23 Thread Eric
Robert Greayer wrote: --- Eric <[EMAIL PROTECTED]> wrote: Hi all, I've written the following program to connect to a submit an HTTP GET request to a server and print the response: module Main where import Network import System.IO main = withSocketsDo go go = do putStrLn "Connecting...

Re: [Haskell-cafe] problems with derive/TH

2008-05-23 Thread Alfonso Acosta
On Fri, May 23, 2008 at 5:11 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > I am assuming this used to work, but something changed, either in TH > itself or switching from ghc6.6 to ghc6.8. The "deriving" rules of 6.8 are more restrictive in some cases. However, the same result can be obtained

Re: [Haskell-cafe] problems with derive/TH

2008-05-23 Thread Stuart Cook
On Sat, May 24, 2008 at 1:11 AM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > World.hs:42:0: > No instances for (Eq (a (M.Map String Player)), > Eq (a (M.Map ItemId Item)), > Eq (a (M.Map PlayerId Player)), > Eq (a (M.Map RoomId Room)), >

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Henning Thielemann
On Fri, 2 May 2008, Neil Mitchell wrote: Hi Don, Just a quick announcement, I've uploaded to hackage 'ghc-core' , a wrapper over ghc for displaying the optimised core and assembly language ghc produces from your programs. This is cool, but it still lags behind the facilities found in yhc-

[Haskell-cafe] problems with derive/TH

2008-05-23 Thread Thomas Hartman
Haskellers/Chris, As part of my quest to better understand STM and eventually build a concurrent haskell server app, I checked out an embryonic haskell mud demo from Chris Smith's repo. It seemed like a great sample app. But I ran into a build issue that seems to have to do with derive/TH.

Re[2]: [Haskell-cafe] Trying to write a very simple HTTP Client

2008-05-23 Thread Bulat Ziganshin
Hello Johan, Friday, May 23, 2008, 5:58:04 PM, you wrote: >> cs<- hGetLine out >> hClose out >> print cs >> > I think you need to either print cs before you close the socket or > make sure that cs is force (~computed) before you close the socket as > laziness mak

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

2008-05-23 Thread Jules Bean
Miguel Mitrofanov wrote: I think that MonadZero m => ... is better than just Maybe. If you can have more general solution for free, why fight it? Because Maybe exists and MonadZero doesn't? Jules ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Henning Thielemann
On Fri, 2 May 2008, Neil Mitchell wrote: Hi Don, Just a quick announcement, I've uploaded to hackage 'ghc-core' , a wrapper over ghc for displaying the optimised core and assembly language ghc produces from your programs. This is cool, but it still lags behind the facilities found in yhc-

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] Trying to write a very simple HTTP Client

2008-05-23 Thread Robert Greayer
--- Eric <[EMAIL PROTECTED]> wrote: > Hi all, > > I've written the following program to connect to a > submit an HTTP GET > request to a server and print the response: > > module Main where > > import Network > import System.IO > > main = withSocketsDo go > > go = do putStrLn "Connecting...

[Haskell-cafe] Bug in parallel GHC runtime?

2008-05-23 Thread Dusan Kolar
Hello all, The attached file was compiled by the following command: ghc -O2 --make -threaded ltest1pl.hs -o alall When run in a sequential mode, I get this result: ./alall Starting ... Lst1: 416665 Lst2: 4166916670 T1: 0m 1.0e-6s 36 End! On the other hand, when run in a threaded

Re: [Haskell-cafe] Trying to write a very simple HTTP Client

2008-05-23 Thread Johan Tibell
On Fri, May 23, 2008 at 3:27 PM, Eric <[EMAIL PROTECTED]> wrote: > Hi all, > > I've written the following program to connect to a submit an HTTP GET > request to a server and print the response: > > module Main where > > import Network > import System.IO > > main = withSocketsDo go > > go = do putS

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-23 Thread Dmitri O.Kondratiev
Do any general-purpose monad 'do' (>>=) and (>>) operator desugaring tools exist? Such that I could first go from 'do' to bind notation and then expand (>>=) definition, as Oliver compactly did. I also tried to expand (>>=) by hand in 'getAny' code, though somewhat differently (see below my pseudo

[Haskell-cafe] Trying to write a very simple HTTP Client

2008-05-23 Thread Eric
Hi all, I've written the following program to connect to a submit an HTTP GET request to a server and print the response: module Main where import Network import System.IO main = withSocketsDo go go = do putStrLn "Connecting..." out <- connectTo "haskell.org" (PortNumber 80)

Re: [Haskell-cafe] What to do when GHC works, RUNGHC fails

2008-05-23 Thread Alistair Bayley
2008/5/23 Peter Verswyvelen <[EMAIL PROTECTED]>: > So it seems the GHCi linker is not using the metadata in the library file > correctly? The libpng.dll.a library file clearly contains a reference to > libpng3.dll, and I guess since GHC is using the GCC linker, this works fine, > but GHCi most l

RE: [Haskell-cafe] What to do when GHC works, RUNGHC fails

2008-05-23 Thread Peter Verswyvelen
So it seems the GHCi linker is not using the metadata in the library file correctly? The libpng.dll.a library file clearly contains a reference to libpng3.dll, and I guess since GHC is using the GCC linker, this works fine, but GHCi most likely has its own linker? If this is correct, we should

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

2008-05-23 Thread Krasimir Angelov
That is annoying. I remember that there were people arguing that Monad should be used instead of Maybe but I don't remember the reasons. Personaly I feel quite happy with Maybe and I am using it in my own code. There should be a consistent approach in the different libraries or at least in a single

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

2008-05-23 Thread Bayley, Alistair
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of 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. >

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

[Haskell-cafe] London Haskell Get Together

2008-05-23 Thread Dominic Steinitz
For information, not an "official" user group get together but I believe the evening was enjoyed by all participants. Dominic. http://enhyper.blogspot.com/2008/05/haskell-get-together-22nd-may-2008.html ___ Haskell-Cafe mailing list Haskell-Cafe@haske

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

2008-05-23 Thread Krasimir Angelov
The monads design is used in Data.Map i.e. lookup :: (Monad m, Ord k) => k -> Map k a -> m a and I think that this will be more consistent. On 5/23/08, Ross Paterson <[EMAIL PROTECTED]> wrote: > On Fri, May 23, 2008 at 09:03:29AM +0200, Krasimir Angelov wrote: > > Alternatively I can use monad

Re: [Haskell-cafe] What to do when GHC works, RUNGHC fails

2008-05-23 Thread Alistair Bayley
2008/5/22 Peter Verswyvelen <[EMAIL PROTECTED]>: > The first thing I noticed is that RUNGHC looks for a DLL called "png.dll" > (which it doesn't find and then bails out with an error), while the > executable build with GHC uses the correct "libpng3.dll". When I rename the > libpng3.dll into png.dll

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

2008-05-23 Thread Ross Paterson
On Fri, May 23, 2008 at 09:03:29AM +0200, Krasimir Angelov wrote: > Alternatively I can use monad with failure. In other words, there are > two possibilities: > > 1. Use error ".." and types like: TreeLoc a -> TreeLoc a > 2. Use monad and type like: Monad m => TreeLoc a -> m (TreeLoc a) I

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

2008-05-23 Thread Krasimir Angelov
On Fri, May 23, 2008 at 9:03 AM, Krasimir Angelov <[EMAIL PROTECTED]> wrote: > if isFirst loc > then do_something (left loc) > else i_cannot_go_left I meant: if isFirst loc then i_cannot_go_left else do_something (left loc) ___ Haskell-Cafe mailin

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 direct