Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Don Stewart
jules: > Felipe Lessa wrote: > >On Dec 4, 2007 1:28 AM, Don Stewart <[EMAIL PROTECTED]> wrote: > >>-- How to display results > >>instance Show Action where > >>show MoveOutOfBounds= "Sorry you can't move in that > >>direction." > >>show (MoveBadTerrain a) = case

Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Jules Bean
Felipe Lessa wrote: On Dec 4, 2007 1:28 AM, Don Stewart <[EMAIL PROTECTED]> wrote: -- How to display results instance Show Action where show MoveOutOfBounds= "Sorry you can't move in that direction." show (MoveBadTerrain a) = case a of

Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Henning Thielemann
On Tue, 4 Dec 2007, Dougal Stanton wrote: > On 04/12/2007, Felipe Lessa <[EMAIL PROTECTED]> wrote: > > > > I always thought show was meant for returning a String that could be > > used to recreate the original data if you copy-pasted it in your code > > or if you used read (i.e. read . show == id

Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Dougal Stanton
On 04/12/2007, Felipe Lessa <[EMAIL PROTECTED]> wrote: > > I always thought show was meant for returning a String that could be > used to recreate the original data if you copy-pasted it in your code > or if you used read (i.e. read . show == id). Reading the > documentation more carefully, I see t

Re: [Haskell-cafe] Advice for clean code.

2007-12-04 Thread Felipe Lessa
On Dec 4, 2007 1:28 AM, Don Stewart <[EMAIL PROTECTED]> wrote: > -- How to display results > instance Show Action where > show MoveOutOfBounds= "Sorry you can't move in that direction." > show (MoveBadTerrain a) = case a of > Wall -

Re: [Haskell-cafe] Advice for clean code.

2007-12-03 Thread Andrew Wagner
Don's code intrigued me, so I fired up my trusty emacs and ghci, and turned it into actual code, which type-checks. Well, ok, I kind of randomly poked at it, while begging for help, which I received in abundance from #haskell, particularly oerjan, and Don himself. Anyway, here's the code: {-# OPTI

Re: [Haskell-cafe] Advice for clean code.

2007-12-03 Thread Don Stewart
stefanor: > On Mon, Dec 03, 2007 at 08:47:48PM -0600, David McBride wrote: > > I am still in the early stages learning haskell, which is my first foray > > into functional programming. Well there's no better way to learn than to > > write something, so I started writing a game. > > > > Mostly th

Re: [Haskell-cafe] Advice for clean code.

2007-12-03 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 08:47:48PM -0600, David McBride wrote: > I am still in the early stages learning haskell, which is my first foray > into functional programming. Well there's no better way to learn than to > write something, so I started writing a game. > > Mostly the thing looks good so

[Haskell-cafe] Advice for clean code.

2007-12-03 Thread David McBride
I am still in the early stages learning haskell, which is my first foray into functional programming. Well there's no better way to learn than to write something, so I started writing a game. Mostly the thing looks good so far, far better than the C version did. However, my problem is that c