Well, Maybe IS a monad, so I just use "m" prefix. Отправлено с iPhone
Apr 22, 2011, в 21:14, Evan Laforge <[email protected]> написал(а): > 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 <- lookup something > case maybe_block of > Just block -> ... > > However, this maybe_ prefix is rather long and unwieldy. I have > considered things like 'm' or 'mb' but they don't suggest Maybe to me. > An 'm' prefix or suffix is already implying 'monad'. If '?' were > allowed in identifiers I could use it as a suffix. I could just > append 'q' and get used to it... lispers did it with 'p' after all. I > suppose 'mby' could be ok, but for some reason it just looks ugly to > me. 'opt' looks ok, I suppose, but 'optional' doesn't cover the full > range of Maybe's usage (i.e. it's strange to call a failed lookup > result "optional"). Does anyone else have a nice convention for this? > Hopefully something short but intuitive and nicely reading like the > plural convention? > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
