[Haskell-cafe] Win32 API

2009-09-19 Thread Andrew Coppin
Hi guys. Last time I looked at the Win32 bindings, it covered a few basic file I/O things (e.g., special access modes, file permissions, etc.), registry editing, and that was about it. Yesterday I took another look, and was pleasently surprised to find that GDI is now covered. Suffice it to

[Haskell-cafe] Why the stack overflow?

2009-09-19 Thread staafmeister
Hi haskell-cafe, Why does rlist 10 [] gives stack overflow in ghci? rlist 0 l = return l rlist n l = do {x - randomRIO (1,maxBound::Int); let nl = x:l in nl `seq` rlist (n-1) nl} I first uses replicateM then foldM and finally an explicit function. But they give all stack overflow I don't

Re: [Haskell-cafe] Why the stack overflow?

2009-09-19 Thread Daniel Fischer
Am Samstag 19 September 2009 12:37:41 schrieb staafmeister: Hi haskell-cafe, Why does rlist 10 [] gives stack overflow in ghci? rlist 0 l = return l rlist n l = do {x - randomRIO (1,maxBound::Int); let nl = x:l in nl `seq` rlist (n-1) nl} I first uses replicateM then foldM and finally

Re: [Haskell-cafe] Win32 API

2009-09-19 Thread Duncan Coutts
On Sat, 2009-09-19 at 08:52 +0100, Andrew Coppin wrote: This was complicated by a small glitch: Graphics.Win32.Window exposes SendMessage() but does not expose PostMessage(). Kind of an important difference there. Fortunately, it's not actually especially hard to fix this deficiency.

Re: [Haskell-cafe] Suggested additions to System.FilePath.Posix/Windows

2009-09-19 Thread Duncan Coutts
On Thu, 2009-09-17 at 11:58 +0200, Marcus D. Gabriel wrote: -- | 'reduceFilePath' returns a pathname that is reduced to canonical -- form equivalent to that of ksh(1), that is, symbolic link names are -- treated literally when finding the directory name. See @cd -L@ of -- ksh(1).

[Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-19 Thread Sean Leather
Hi Daneel, On Sat, Sep 19, 2009 at 13:58, Daneel Yaitskov wrote: Recently I've found wonderful thing cabal can install packages itself! It can even install those packages which need for final one. But I'm disturbed cabal doesn't create the documentation of a package by default. It manually

Re: [Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-19 Thread Gwern Branwen
On Sat, Sep 19, 2009 at 11:59 AM, Sean Leather leat...@cs.uu.nl wrote: Hi Daneel, On Sat, Sep 19, 2009 at 13:58, Daneel Yaitskov wrote: Recently I've found wonderful thing cabal can install packages itself! It can even install those packages which need for final one. But I'm disturbed cabal

[Haskell-cafe] Re: Is it safe to use unsafePerformIO here?

2009-09-19 Thread Ben Franksen
Cristiano Paris wrote: Daniel Fischer wrote: I would separate the reading of headers and bodies, reopening the files whose body is needed, for some (maybe compelling) reason he wants to do it differently. Yes, that's the way Haskell forces you to do that as it's the only way for you to go

[Haskell-cafe] Haskell Weekly News: Issue 131 - September 19, 2009

2009-09-19 Thread Joe Fredette
Hopefully the line endings come out okay this week, I did a test before sending it to the list, please let me know if you notice anything awry. Just put a [HWN] in the subject line so my filter's will catch it. /metaeditorial

Re: [Haskell-cafe] Why the stack overflow?

2009-09-19 Thread Derek Elkins
On Sat, Sep 19, 2009 at 6:54 AM, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Samstag 19 September 2009 12:37:41 schrieb staafmeister: Hi haskell-cafe, Why does rlist 10 [] gives stack overflow in ghci? rlist 0 l = return l rlist n l = do {x - randomRIO (1,maxBound::Int); let nl =

Re: [Haskell-cafe] Suggested additions to System.FilePath.Posix/Windows

2009-09-19 Thread Brandon S. Allbery KF8NH
On Sep 19, 2009, at 07:45 , Duncan Coutts wrote: On Thu, 2009-09-17 at 11:58 +0200, Marcus D. Gabriel wrote: -- | 'reduceFilePath' returns a pathname that is reduced to canonical -- form equivalent to that of ksh(1), that is, symbolic link names are -- treated literally when finding the

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-19 Thread Andy Gimblett
On 17 Sep 2009, at 18:01, Ryan Ingram wrote: Here's a way that works more closely to your original version: instance Enumerated a = Target a where convert n | n = 0 n numConstrs = Just (constrs !! n) | otherwise = Nothing where constrs = constructors

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-19 Thread Daniel Fischer
Am Samstag 19 September 2009 20:55:10 schrieb Andy Gimblett: On 17 Sep 2009, at 18:01, Ryan Ingram wrote: Here's a way that works more closely to your original version: instance Enumerated a = Target a where convert n | n = 0 n numConstrs = Just (constrs !! n) |

[Haskell-cafe] Re: Suggested additions to System.FilePath.Posix/Windows

2009-09-19 Thread Simon Marlow
Brandon S. Allbery KF8NH wrote: On Sep 19, 2009, at 07:45 , Duncan Coutts wrote: On Thu, 2009-09-17 at 11:58 +0200, Marcus D. Gabriel wrote: -- | 'reduceFilePath' returns a pathname that is reduced to canonical -- form equivalent to that of ksh(1), that is, symbolic link names are -- treated

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-19 Thread Edward Kmett
A few issues, you can remove the overlapping instances by using a newtype wrapper to disambiguate which instance you want. A little alarm bell goes off in my head whenever I read 'instance Foo a'. newtype Wrapped a = Wrapped a instance Target Foo where ... instance Enumerated a = Target

Re: [Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-19 Thread Michael Shulman
Gwern Branwen wrote: If you use cabal-install (as you should!), you can have it build haddocks by customizing ~/.cabal/config and adding: documentation: True Is there a way to make it automatically update a single contents page with links to the documentation of all installed packages? I