[Haskell-cafe] Write Haskell as fast as C. [Was: Re: GHC predictability]

Evan Laforge qdunkan at gmail.com
Thu May 15 15:42:35 EDT 2008


> Side point: Is the name "go" part of the idiom you mentioned? I
> sometimes use the same practise but usually just calls the worker the
> same as the real function with an added prime (').

I like to use "go" or the name of the function with _ prepended.  For
threading state type things outside of a monad, I generally use
numbers "let state2 = f state1".  I know the prime is conventional,
but it's such a tiny mark on a symbol that's otherwise identical I
tend to lose it accidentally, leading to type errors for the first, or
either bus errors or silently doing the wrong thing for the second
(fortunately ghc's unused variable check has always caught that, but I
did spend some time thinking the bus error was c++'s fault...).

If the "accumulator" function has the same signature as the "wrapper"
you can also get silently wrong behaviour by recursing to the wrong
function.  It's probably harder to do that with 'go' than with a
prime.


More information about the Haskell-Cafe mailing list