[Haskell-cafe] Trying to write 'safeFromInteger'

Ketil Malde ketil at malde.org
Thu Apr 9 11:30:28 EDT 2009


Neil Mitchell <ndmitchell at gmail.com> writes:

>> Other than using go and foo', what do people use in Haskell?

I tend to use 'go' for recursive or iterative functions.  Which I
belive is the original dons idiom.

I occasionally use foo', but it is all too easy to write foo when you
mean foo', and, which is worse, it occasionally happens to compile.

> I use f, if I need several auxiliary functions I start at f and work
> my way up alphabetically.

:-)

> makeValid path = joinDrive drv $ validElements $ validChars pth
>     where
>         (drv,pth) = splitDrive path
>
>         validChars x = map f x
>         f x | x `elem` badCharacters = '_'
>             | otherwise = x

In cases like this, I use names like 'foo1', since it does 'foo' for
one element.  So here I'd name 'f' something like 'valid1'.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list