Re: [Haskell-cafe] cgi liftM liftIO

2008-06-14 Thread Adrian Neumann
I think you need to put liftIO in front of the IO actions you want to do inside the CGI Monad. Like in this example http://www.haskell.org/haskellwiki/ Practical_web_programming_in_Haskell#File_uploads (Why did I need to use google to find that? The wiki search in awful. Searching for

Re: [Haskell-cafe] cgi liftM liftIO

2008-06-14 Thread Gwern Branwen
On 2008.06.14 08:05:48 +0200, Adrian Neumann [EMAIL PROTECTED] scribbled 4.0K characters: I think you need to put liftIO in front of the IO actions you want to do inside the CGI Monad. Like in this example http://www.haskell.org/haskellwiki/ Practical_web_programming_in_Haskell#File_uploads

Re: [Haskell-cafe] FunPtr error?

2008-06-14 Thread Galchin, Vasili
oops .. my bad ... If I change data Sigval = SivalInt Int to newtype Sigval = SivalInt Int OR data Sigval = SivalPtr (Ptr Char) to newtype Sigval = SivalPtr (Ptr Char). Why should newtype instead of a data type allow my test case to build? Vasili On Fri, Jun 13, 2008 at 10:59

Re: [Haskell-cafe] monomorphism restriction

2008-06-14 Thread Rafal Kolanski
Ryan Ingram wrote: sumns 0 = 0 sumns x = sumns (x-1) + n Without the monomorphism restriction, computing n is a function call; it is evaluated each time it is asked for. I'm relatively new to Haskell, and since this topic already came up, I was wondering if anyone could explain to me how

Re: [Haskell-cafe] cabal-install failure

2008-06-14 Thread Duncan Coutts
On Fri, 2008-06-13 at 22:10 -0400, Gwern Branwen wrote: I think this may be Cabal's fault anyway. The yi.cabal includes the line: build-tools: alex = 2.0.1 3 in the 'executable yi' section, right after the build-depends, so Yi is being straightforward and upfront about its

Re: [Haskell-cafe] cabal-install failure

2008-06-14 Thread Claus Reinke
http://hackage.haskell.org/trac/hackage/ticket/227 One problem is that not all build-tools correspond to haskell packages. Some do some don't. We have a hard coded list of them at the moment (which can be extended in Setup.hs files) so we could extend that with what

[Haskell-cafe] Re: working with Random.randoms

2008-06-14 Thread Jon Fairbairn
Stephen Howard [EMAIL PROTECTED] writes: I am a newcomer doing my obligatory struggling with Haskell's type system, That's your mistake. Don't struggle with the type system, the type system is your friend; when it tells you you are doing something wrong, it's usually right. and I've got a

[Haskell-cafe] ANN: Topkata

2008-06-14 Thread Christoph Bauer
Hi All, Topkata is a simple OpenGL Game written in Haskell. It's not very advanced. Goal so far is to guide a ball trough an labyrinth to the opposite corner. The web page shows an screenshot. It's only tested under Linux. http://home.arcor.de/chr_bauer/topkata.html FeedbackPatches are

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Neil Mitchell
Hi Christoph, opposite corner. The web page shows an screenshot. It's only tested under Linux. Looks cool! Could you upload it to hackage? http://hackage.haskell.org/ Once its on hackage, using cabal install, it should be possible to get your game going with as little as: cabal install

[Haskell-cafe] ANN: Mueval 0.21

2008-06-14 Thread Gwern Branwen
Hiya everyone. I'd like to announce the release of a little CLI program I whipped up. It's called mueval http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mueval. WHAT: Mueval grew out of my discontent with Lambdabot: it's really neat to be able to run expressions like this: 07:53

[Haskell-cafe] Hoogle totally broken?

2008-06-14 Thread Richard
It'd seem that (at least the online version of) Hoogle is totally broken and useless. See, for example, the output when looking for: Monad m = m a - (a - m b) - m b (i.e. (=)'s type) over at: http://haskell.org/hoogle/?q=Monad+m+%3D+m+a+-+(a+-+m+b)+-+m+b Data.Generics.Sche... everywhere

Re: [Haskell-cafe] Hoogle totally broken?

2008-06-14 Thread Brent Yorgey
On Sat, Jun 14, 2008 at 9:10 AM, Richard [EMAIL PROTECTED] wrote: It'd seem that (at least the online version of) Hoogle is totally broken and useless. See, for example, the output when looking for: Monad m = m a - (a - m b) - m b (i.e. (=)'s type) over at:

Re: [Haskell-cafe] working with Random.randoms

2008-06-14 Thread Henning Thielemann
On Fri, 13 Jun 2008, Stephen Howard wrote: Hi List, I am a newcomer doing my obligatory struggling with Haskell's type system, and I've got a nut I've not been able to crack. Given: import Random random_test :: Int - String random_test n = do g - getStdGen take n (randoms g)::String

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Thomas Davie
On 14 Jun 2008, at 12:45, Christoph Bauer wrote: Hi All, Topkata is a simple OpenGL Game written in Haskell. It's not very advanced. Goal so far is to guide a ball trough an labyrinth to the opposite corner. The web page shows an screenshot. It's only tested under Linux.

Re: [Haskell-cafe] Hoogle totally broken?

2008-06-14 Thread Daniel Fischer
Am Samstag, 14. Juni 2008 15:10 schrieb Richard: It'd seem that (at least the online version of) Hoogle is totally broken and useless. See, for example, the output when looking for: Monad m = m a - (a - m b) - m b (i.e. (=)'s type) over at:

Re: [Haskell-cafe] Hoogle totally broken?

2008-06-14 Thread Neil Mitchell
Hi Richard, It'd seem that (at least the online version of) Hoogle is totally broken and useless. To finish your sentance: when searching for types with higher-kinded type classes. In practice, this usually means Monad and occasionally Functor. ... and so on. (=) isn't there at all!? It

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Henning Thielemann
On Mon, 9 Jun 2008, Sebastian Sylvan wrote: Another BIG reason: It's impossible to export a whole hierarchy qualified. I.e it would be neat if the user could write: import Graphics.UI.Gtk And then have Gtk re-export sub-modules qualified, so you could write Button.new, Window.new etc. etc.

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Henning Thielemann
On Mon, 9 Jun 2008, Duncan Coutts wrote: On Mon, 2008-06-09 at 16:04 +0200, Ketil Malde wrote: And - is there a way to make GHCi use aliased qualification? I find my self typing detailed taxonomies all the time there. The ghci syntax currently is: :m Data.Set wouldn't it be much nicer as:

[Haskell-cafe] External query interface to HackageDB?

2008-06-14 Thread Dimitry Golubovsky
Hi, Is there any way to query the latest version of a particular package stored on Hackage, that was successfully built? I mean, not _how_ to do that (I have some ideas that I have to download directory listings, looking for failure logs, etc.), but is there any tool or interface already

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Sebastian Sylvan
On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Mon, 9 Jun 2008, Sebastian Sylvan wrote: Another BIG reason: It's impossible to export a whole hierarchy qualified. I.e it would be neat if the user could write: import Graphics.UI.Gtk And then have Gtk re-export sub-modules

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Henning Thielemann
On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: The problem would be again that no one knows, where Window comes from. Better would be I really don't see how this is a big problem. Lots of languages do hierarchical import (e.g. .Net

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Christoph Bauer
Hello Neil, Looks cool! Could you upload it to hackage? Thank you. Ok, I uploaded the current version. At the moment you have to run topkata in the topkata-0.0 directory with ./dist/build/topkata/topkata, because it has to find its texture/sound files. Furthermore I encounter problems (i.e.

[Haskell-cafe] ANN: Topkata

2008-06-14 Thread Brent Yorgey
On Sat, Jun 14, 2008 at 10:53 AM, Christoph Bauer [EMAIL PROTECTED] wrote: Hello Neil, Looks cool! Could you upload it to hackage? Thank you. Ok, I uploaded the current version. At the moment you have to run topkata in the topkata-0.0 directory with ./dist/build/topkata/topkata, because

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Neil Mitchell
Hi Looks cool! Could you upload it to hackage? Thank you. Ok, I uploaded the current version. At the moment you have to run topkata in the topkata-0.0 directory with ./dist/build/topkata/topkata, because it has to find its texture/sound files. There's a way to put something in the

[Haskell-cafe] const is question

2008-06-14 Thread odtaa48
hello could someone explain the following differing results const id 0 5 - 5 -- ie. 'takes' the 'last' one const (id 0) 5 - 0 -- ie. 'takes' the 'first' one Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Lazy IO.

2008-06-14 Thread Sebastiaan Visser
Hi, I've got a question about lazy IO in Haskell. The most well known function to do lazy IO is the `hGetContents', which lazily reads all the contents from a handle and returns this as a regular [Char]. The thing with hGetContents is that is puts the Handle in a semi-closed state, no one can

Re: [Haskell-cafe] const is question

2008-06-14 Thread Jake Mcarthur
On Jun 14, 2008, at 11:14 AM, odtaa48 wrote: const id 0 5 - 5 -- ie. 'takes' the 'last' one The type of const is a - b - a. The first argument to const here is id and the second is 0, so the evaluation of const id 0 is going to result in id. Then we apply id to 5, yielding 5. Perhaps it

Re: [Haskell-cafe] const is question

2008-06-14 Thread Sebastiaan Visser
On Jun 14, 2008, at 6:14 PM, odtaa48 wrote: hello could someone explain the following differing results const id 0 5 - 5 -- ie. 'takes' the 'last' one const (id 0) 5 - 0 -- ie. 'takes' the 'first' one Thanks You can easily see what is happening by rewriting the equations step by step.

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Felipe Lessa
(Sorry, Sebastiaan, I hit send accidentally) On Sat, Jun 14, 2008 at 1:18 PM, Sebastiaan Visser [EMAIL PROTECTED] wrote: readHttpMessage :: IO (Headers, Data.ByteString.Lazy.ByteString) readHttpMessage = do myStream - accept http connection from client request - hGetContents myStream

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Isaac Dupree
Sebastiaan Visser wrote: Hi, I've got a question about lazy IO in Haskell. The most well known function to do lazy IO is the `hGetContents', which lazily reads all the contents from a handle and returns this as a regular [Char]. The thing with hGetContents is that is puts the Handle in a

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Sebastiaan Visser
On Jun 14, 2008, at 6:45 PM, Felipe Lessa wrote: (Sorry, Sebastiaan, I hit send accidentally) On Sat, Jun 14, 2008 at 1:18 PM, Sebastiaan Visser [EMAIL PROTECTED] wrote: readHttpMessage :: IO (Headers, Data.ByteString.Lazy.ByteString) readHttpMessage = do myStream - accept http

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Sebastiaan Visser
On Jun 14, 2008, at 6:49 PM, Isaac Dupree wrote: Sebastiaan Visser wrote: Hi, I've got a question about lazy IO in Haskell. The most well known function to do lazy IO is the `hGetContents', which lazily reads all the contents from a handle and returns this as a regular [Char]. The thing

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Felipe Lessa
On Sat, Jun 14, 2008 at 1:50 PM, Sebastiaan Visser [EMAIL PROTECTED] wrote: Doesn't this imply that the parseHttpHeader must work on ByteStrings instead of regular Strings? I made the change because it's easier and faster to go from ByteString to String than the converse. Maybe this works for

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Brandon S. Allbery KF8NH
On 2008 Jun 14, at 12:59, Sebastiaan Visser wrote: But I'm still curious about how to lazily parse messages with arbitrary size Unicode headers and plain (possibly) binary bodies. Sounds like Data.Binary (see hackage) to me. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL

Re: [Haskell-cafe] Lazy IO.

2008-06-14 Thread Sebastiaan Visser
On Jun 14, 2008, at 7:16 PM, Felipe Lessa wrote: On Sat, Jun 14, 2008 at 1:50 PM, Sebastiaan Visser [EMAIL PROTECTED] wrote: Doesn't this imply that the parseHttpHeader must work on ByteStrings instead of regular Strings? I made the change because it's easier and faster to go from

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Sebastian Sylvan
On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: The problem would be again that no one knows, where Window comes from. Better would be I really don't see how this is a big

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Henning Thielemann
On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: The problem would be again that no one knows, where Window comes from. Better would

[Haskell-cafe] ANN: Printf-TH

2008-06-14 Thread Marc Weber
Igloo (Ian Lynagh) allowed me kindly taking over maintainance on his printf library using template haskell written in 2003. I've updated it so that it compiles with ghc-6.8.2. You can get it from hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Printf-TH usage looks like this:

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Sebastian Sylvan
On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: The problem would be

[Haskell-cafe] Documenting the impossible

2008-06-14 Thread Andrew Coppin
I have a small idea. I'm curios if anybody else thinks it's a good idea... How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? For example, you look up a key in a Map. You know the key is there, because you just put it

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Derek Elkins
On Sat, 2008-06-14 at 19:58 +0100, Andrew Coppin wrote: I have a small idea. I'm curios if anybody else thinks it's a good idea... How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? For example, you look up a key

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Henning Thielemann
On Sat, 14 Jun 2008, Andrew Coppin wrote: How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? ... When compiled without optimisations, the pragma just causes an exception to be thrown, rather like error does. When

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Thomas M. DuBuisson
I think when Andy made HPC he added a way to mark code unreachable so it wouldn't harm your test coverage report. On Sat, 2008-06-14 at 19:58 +0100, Andrew Coppin wrote: I have a small idea. I'm curios if anybody else thinks it's a good idea... How about a {-# IMPOSSIBLE #-} pragma that

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Don Stewart
andrewcoppin: I have a small idea. I'm curios if anybody else thinks it's a good idea... How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? For example, you look up a key in a Map. You know the key is there,

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Don Stewart
tom.davie: On 14 Jun 2008, at 12:45, Christoph Bauer wrote: Hi All, Topkata is a simple OpenGL Game written in Haskell. It's not very advanced. Goal so far is to guide a ball trough an labyrinth to the opposite corner. The web page shows an screenshot. It's only tested under Linux.

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Neil Mitchell
Hi How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? Why not make it a function taking a string and returning a value of any type. Then we can keep our language and not break various parsing/type checking properties

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Marc Weber
Does anybody think this is a useful idea? If so I'll add a feature request ticket to the GHC Trac. But I want to see if folks like the idea first... Mmmh.. dont' know. Even Java folks don't allow this kind of creeping bug and I guess they know why. You never want undefined behaviour at least

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Henning Thielemann
On Sat, 14 Jun 2008, Neil Mitchell wrote: Hi How about a {-# IMPOSSIBLE #-} pragma that documents the fact that a particular point in the program *should* be unreachable? Why not make it a function taking a string and returning a value of any type. Then we can keep our language and not

[Haskell-cafe] Template Haskell sugar / spliceing in automatically ?

2008-06-14 Thread Marc Weber
Hi, I've been thinking about template haskell sugar lately. Some cool libraries are there such as metaHDBC or the template haskell printf library. However they all have one thing in common: $(printf ...) a b c $(runStmt INSERT INTO ( ) VALUES ( ?, ?, ? ) ) 2 3 4 Would it make sense to

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Neil Mitchell
Hi * error - inserted by the compiler Example? Pattern-match errors. * abort - deliberate aborting because the user made some mistake. This is an exception. The signature of a function must reflect this by a Maybe, Either type etc. Disagree. I mean more like: when (Delete `elem`

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Henning Thielemann
On Sat, 14 Jun 2008, Neil Mitchell wrote: Hi * error - inserted by the compiler Example? Pattern-match errors. Calling a function with patterns it cannot process is a programming error. * abort - deliberate aborting because the user made some mistake. This is an exception. The

[Haskell-cafe] Re: Documenting the impossible

2008-06-14 Thread Peter Hercek
Andrew Coppin wrote: -- cut -- When compiled without optimisations, the pragma just causes an exception to be thrown, rather like error does. When compiled with optimisations, the whole case alternative is removed, and no code is generated for it. (And if the impossible somehow happens...

Re: [Haskell-cafe] Template Haskell sugar / spliceing in automatically ?

2008-06-14 Thread Derek Elkins
On Sat, 2008-06-14 at 23:06 +0200, Marc Weber wrote: Hi, I've been thinking about template haskell sugar lately. Some cool libraries are there such as metaHDBC or the template haskell printf library. However they all have one thing in common: $(printf ...) a b c $(runStmt INSERT INTO

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-14 Thread Isaac Dupree
Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 14 Jun 2008, Sebastian Sylvan wrote: On 6/14/08, Henning Thielemann [EMAIL PROTECTED] wrote:

Re: [Haskell-cafe] Documenting the impossible

2008-06-14 Thread Isaac Dupree
Neil Mitchell wrote: * abort - deliberate aborting because the user made some mistake. This is an exception. The signature of a function must reflect this by a Maybe, Either type etc. Disagree. I mean more like: when (Delete `elem` flags Keep `elem` flags) $ abort User cannot pick both

Re: [Haskell-cafe] monomorphism restriction

2008-06-14 Thread Jonathan Cast
On Sat, 2008-06-14 at 17:19 +1000, Rafal Kolanski wrote: Ryan Ingram wrote: sumns 0 = 0 sumns x = sumns (x-1) + n Without the monomorphism restriction, computing n is a function call; it is evaluated each time it is asked for. I'm relatively new to Haskell, and since this topic

Re: [Haskell-cafe] ANN: Topkata

2008-06-14 Thread Deborah Goldsmith
On Jun 14, 2008, at 1:06 PM, Don Stewart wrote: tom.davie: In the mean time -- who knows enough to make ghc target ARM, and get this to link against the iPhone libraries? This would be quite a coup if it could be made to run there! I'd be interested. We should start a wiki page for