[Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Evan Laforge
Here's a simple issue that's been with me for a while. As do many people, I use plural variable names for lists, so if a Block as called 'block' then [Block] is 'blocks'. The other pattern that comes up a lot is 'Maybe Block'. When I have to name it, I call it 'maybe_block', e.g. maybe_block -

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Matthew Steele
In my own code, I usually use a 'mb' prefix with camelCase, like so: case mbStr of Just str - ... Nothing - ... But I agree that it doesn't always look very nice. I'm curious what others do. On Apr 22, 2011, at 1:14 PM, Evan Laforge wrote: Here's a simple issue that's been with

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Evgeny Tarasov
I do it in a similar way, not just for maybes: paramMay - getHTTPPostParam Param paramStr - maybe (throwError No Param parameter) return paramMay let paramE = parseParam paramStr param - case paramE of Left e - throwError $ Error while parsing Param: ++ show e Right p - return p It'd be great,

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Henning Thielemann
On Fri, 22 Apr 2011, Evgeny Tarasov wrote: I do it in a similar way, not just for maybes: paramMay - getHTTPPostParam Param paramStr - maybe (throwError No Param parameter) return paramMay let paramE = parseParam paramStr param - case paramE of Left e - throwError $ Error while parsing Param:

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Stephen Tetley
Hi Evan The EHC compiler code base seems to use mbSomething as a convention. As EHC has quite a lot of textual information in its source - the code is Haskell + attribute grammars + Shuffle + plus more - the mb convention seems to work well and I adopted it for myself after seeing it there.

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Evan Laforge
Of course, naming will always be a matter of taste. For instance I would not write maybe_something, because I prefer camel case, that is, maybeSomething. On the other hand, I already wrote some Wiki articles that you may read as suggestions for certain naming conventions:  

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread Miguel Mitrofanov
Well, Maybe IS a monad, so I just use m prefix. Отправлено с iPhone Apr 22, 2011, в 21:14, Evan Laforge qdun...@gmail.com написал(а): Here's a simple issue that's been with me for a while. As do many people, I use plural variable names for lists, so if a Block as called 'block' then [Block]

Re: [Haskell-cafe] naming convention for maybes?

2011-04-22 Thread wren ng thornton
On 4/22/11 1:14 PM, Evan Laforge wrote: Here's a simple issue that's been with me for a while. As do many people, I use plural variable names for lists, so if a Block as called 'block' then [Block] is 'blocks'. The other pattern that comes up a lot is 'Maybe Block'. When I have to name it, I