Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: How to model this in haskell, get rid of my OO thinking? (Nathan Huesken) 2. HOpenGL questions (Nathan Huesken) 3. Re: Haskell described as a "rigid" language (a...@spamcop.net) 4. Re: HOpenGL questions (Thomas Davie) 5. Re: HOpenGL questions (Thomas Davie) 6. Re: How to model this in haskell, get rid of my OO thinking? (Henk-Jan van Tuyl) 7. WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? (James Fenn) 8. Re: WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? (Nathan Huesken) 9. Re: WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? (Daniel Fischer) ---------------------------------------------------------------------- Message: 1 Date: Tue, 18 May 2010 19:08:15 -0400 From: Nathan Huesken <hask...@lonely-star.org> Subject: Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? To: beginners@haskell.org Message-ID: <20100518190815.3922c...@samzwo> Content-Type: text/plain; charset=US-ASCII Hey, I think I am getting grasp of it. Thanks for all the help! ------------------------------ Message: 2 Date: Tue, 18 May 2010 19:10:27 -0400 From: Nathan Huesken <hask...@lonely-star.org> Subject: [Haskell-beginners] HOpenGL questions To: Biginners Haskell Mailinglist <beginners@haskell.org> Message-ID: <20100518191027.09539...@samzwo> Content-Type: text/plain; charset=US-ASCII Hi, I send this mail to the HOpenGL mailinglist. I did not get a reply. I hope it is OK to ask this question here. I am new to Haskell, but not new to OpenGL. I am reading the tutorials on the HOpenGL page and have a few questions. - First of all, all tutorials are using GLUT. Is that really the way to go with HOpenGL? They define (among other things) a onIdle and a onDraw function. That seems to me (at least for a game) not the way to go. onIdle updates the game logic, and onDraw draws the screen. As far as I can see, it does not make sense to update the game logic more than once between consecutive calls to onDraw. Same thing is true for class to onDraw between consecutive class to onIdle. Is this accounted for in the approach? - In addition there is the onInput function. The onInput, onIdle and onDraw functions communicate (in the tutorials) using variables declared with newIORef. I come from the OO language C++ and almost no experience with functional languages. But this puzzles me. Basically they define global variables for the exchange between the callback functions, correct?!? So, for every piece of information I want to pass between these functions, I have to declare a newIORef variable? In C/C++ I find GLUT not a very good approach and prefer plain OpenGL. Does it make sense to go with plain OpenGL in Haskell too? Are there any resources on how to do that? Thanks! Nathan ------------------------------ Message: 3 Date: Wed, 19 May 2010 02:27:30 -0400 From: a...@spamcop.net Subject: Re: [Haskell-beginners] Haskell described as a "rigid" language To: beginners@haskell.org Message-ID: <20100519022730.2mwl762p4owg004c-...@webmail.spamcop.net> Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" G'day all. The trouble with calling a programming language "rigid" is that it could either mean that you need to re-think some assumptions about how you program compared to the languages you know, or it could mean that it's a Turing tarpit. Sometimes, even experts find it hard to tell the difference until they've used the language for a while. Andrew Bromage ------------------------------ Message: 4 Date: Wed, 19 May 2010 07:43:38 +0100 From: Thomas Davie <tom.da...@gmail.com> Subject: Re: [Haskell-beginners] HOpenGL questions To: Nathan Huesken <hask...@lonely-star.org> Cc: Biginners Haskell Mailinglist <beginners@haskell.org> Message-ID: <e8a67643-f981-4d43-92e8-019fa17e0...@gmail.com> Content-Type: text/plain; charset=windows-1252 > - First of all, all tutorials are using GLUT. Is that really the way to > go with HOpenGL? Probably not, but this is pretty typical of OpenGL tutorials they use GLUT because it's simple to get going, and avoids having to demonstrate lots of things that are irrelevant to OpenGL. > They define (among other things) a onIdle and a > onDraw function. That seems to me (at least for a game) not the way > to go. onIdle updates the game logic, and onDraw draws the screen. As > far as I can see, it does not make sense to update the game logic > more than once between consecutive calls to onDraw. Same thing is > true for class to onDraw between consecutive class to onIdle. Is this > accounted for in the approach? Actually, at least the onIdle running many times between onDraw is completely reasonable for a game... To keep your physics simulation accurate, you want nice, short, time steps, you don't necessarily want to be rendering each and every one of them though. > - In addition there is the onInput function. The onInput, onIdle and > onDraw functions communicate (in the tutorials) using variables > declared with newIORef. I come from the OO language C++ and almost no > experience with functional languages. But this puzzles me. Basically > they define global variables for the exchange between the callback > functions, correct?!? So, for every piece of information I want to > pass between these functions, I have to declare a newIORef variable? Yeh, that's horribly horribly ugly. I would personally be spawning two threads, one to repeatedly update the game's state, and one to render. The functions for each thread would accept a channel as input. The game state updater would push game states into the channel, the renderer would pull all of them out and render the last one it finds. > In C/C++ I find GLUT not a very good approach and prefer plain OpenGL. > Does it make sense to go with plain OpenGL in Haskell too? Are there > any resources on how to do that? I don't get how you use "plain OpenGL". There are no calls in OpenGL to set up graphics contexts, or accept user input etc. Personally, I would be using your own system's functions for doing this though i.e. on Mac OS I would be using Cocoa to do it; on Linux GTK/Qt; on Windows .Net; etc. Bob ------------------------------ Message: 5 Date: Wed, 19 May 2010 07:47:04 +0100 From: Thomas Davie <tom.da...@gmail.com> Subject: Re: [Haskell-beginners] HOpenGL questions To: Nathan Huesken <hask...@lonely-star.org> Cc: Biginners Haskell Mailinglist <beginners@haskell.org> Message-ID: <12eaff62-19d3-4ad3-9fbe-da3786414...@gmail.com> Content-Type: text/plain; charset=us-ascii p.s. My answer to how I would structure a program using OpenGL was rather a pragmatic version, as I expect you were wanting. My actual answer to how I'd *like* to see this work, is actually to have a much more functional design... Such a design would use FRP to compute the game world state, and main in my program would have roughly the type Behaviour PlayerInput -> Behaviour SceneGraph. ------------------------------ Message: 6 Date: Wed, 19 May 2010 10:02:06 +0200 From: "Henk-Jan van Tuyl" <hjgt...@chello.nl> Subject: Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? To: "Beginners Haskell Mailinglist" <beginners@haskell.org>, hask...@lonely-star.org Message-ID: <op.vcx0lstfpz0...@zen5.router.home> Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes On Tue, 18 May 2010 05:21:38 +0200, <hask...@lonely-star.org> wrote: > Hi, > > I learning haskell and I am trying to understand how model certain > things in it. > As I have been doing a lot of C++ programming so far. Let's imagine we > want to write a game. In the game there are spaceships and rocks (image > something like astroids :) ). Now both spaceships and rocks have a > position and can move. Spaceships can shoot, while rocks can explode. There is a well documented implementation, called wxAsteroids; see http://www.haskell.org/haskellwiki/WxAsteroids Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html -- ------------------------------ Message: 7 Date: Wed, 19 May 2010 13:43:20 +0100 From: James Fenn <hask...@jamesfenn.com> Subject: WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? To: beginners@haskell.org Message-ID: <aanlktimgcde0hgpbu6yc4jvoncvryyez7kpapfpj9...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 For me on ubuntu karmic and haskell platform 2010.1, WxWidgets doesn't seem to be responding to keypresses. I have only tried it with WxAsteroids as I thought it would be useful for me to study. Does anyone else have the same problem? Cheers, James On 19 May 2010 09:02, Henk-Jan van Tuyl <hjgt...@chello.nl> wrote: > > On Tue, 18 May 2010 05:21:38 +0200, <hask...@lonely-star.org> wrote: > >> Hi, >> >> I learning haskell and I am trying to understand how model certain >> things in it. >> As I have been doing a lot of C++ programming so far. Let's imagine we >> want to write a game. In the game there are spaceships and rocks (image >> something like astroids :) ). Now both spaceships and rocks have a >> position and can move. Spaceships can shoot, while rocks can explode. > > There is a well documented implementation, called wxAsteroids; see > http://www.haskell.org/haskellwiki/WxAsteroids > > Regards, > Henk-Jan van Tuyl > > > -- > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > -- > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 8 Date: Wed, 19 May 2010 08:46:46 -0400 From: Nathan Huesken <hask...@lonely-star.org> Subject: Re: WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? To: beginners@haskell.org Message-ID: <20100519084646.224c7...@samzwo> Content-Type: text/plain; charset=UTF-8 On Wed, 19 May 2010 13:43:20 +0100 James Fenn <hask...@jamesfenn.com> wrote: > For me on ubuntu karmic and haskell platform 2010.1, WxWidgets doesn't > seem to be responding to keypresses. I have only tried it with > WxAsteroids as I thought it would be useful for me to study. Does > anyone else have the same problem? > Cheers, > James > > On 19 May 2010 09:02, Henk-Jan van Tuyl <hjgt...@chello.nl> wrote: > > > > On Tue, 18 May 2010 05:21:38 +0200, <hask...@lonely-star.org> wrote: Yes, same problem here. Gentoo, installed wxHaskell over cabal (because the gentoo ebuild is outdated). > > > >> Hi, > >> > >> I learning haskell and I am trying to understand how model certain > >> things in it. > >> As I have been doing a lot of C++ programming so far. Let's > >> imagine we want to write a game. In the game there are spaceships > >> and rocks (image something like astroids :) ). Now both spaceships > >> and rocks have a position and can move. Spaceships can shoot, > >> while rocks can explode. > > > > There is a well documented implementation, called wxAsteroids; see > > Â http://www.haskell.org/haskellwiki/WxAsteroids > > > > Regards, > > Henk-Jan van Tuyl > > > > > > -- > > http://Van.Tuyl.eu/ > > http://members.chello.nl/hjgtuyl/tourdemonad.html > > -- > > _______________________________________________ > > Beginners mailing list > > Beginners@haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > ------------------------------ Message: 9 Date: Wed, 19 May 2010 17:23:45 +0200 From: Daniel Fischer <daniel.is.fisc...@web.de> Subject: Re: WxHaskell problems was Re: [Haskell-beginners] How to model this in haskell, get rid of my OO thinking? To: beginners@haskell.org Message-ID: <201005191723.46490.daniel.is.fisc...@web.de> Content-Type: text/plain; charset="utf-8" On Wednesday 19 May 2010 14:46:46, Nathan Huesken wrote: > On Wed, 19 May 2010 13:43:20 +0100 > > James Fenn <hask...@jamesfenn.com> wrote: > > For me on ubuntu karmic and haskell platform 2010.1, WxWidgets doesn't > > seem to be responding to keypresses. I have only tried it with > > WxAsteroids as I thought it would be useful for me to study. Does > > anyone else have the same problem? > > Cheers, > > James > > > > On 19 May 2010 09:02, Henk-Jan van Tuyl <hjgt...@chello.nl> wrote: > > > On Tue, 18 May 2010 05:21:38 +0200, <hask...@lonely-star.org> wrote: > > Yes, same problem here. Gentoo, installed wxHaskell over cabal (because > the gentoo ebuild is outdated). Yes, here too (openSUSE 11.1), though it does respond to Ctrl+[N/P/Q], but not to any other keypress. ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 23, Issue 30 *****************************************