refactor to method

a helper method to output an anonymous function.
I had to implement (eval (Var s)), otherwise eval would get stuck in a
loop.
refactor to type

The type (Writer [String] a) was used several types, so I gave it a
name.
State monad for increasing generated names

I didn't expect such a simple translation to require monad transformers,
but oh well.

I want to output a sequence of anonymous functions, but C functions
can't be anonymous, so I need to generate names for them. To generate a
sequence of names, I need to maintain a counter, and since Haskell has
no global variables, I need to use the State monad to thread this state
through the computation.

Since we're already using the Writer monad, I need to combine the two
monads by turning one of them into a monad transformer. Writer is the
outer monad, so I can use its tell method directly, while State is the
inner monad, so I need to use lift in order to access its get and put
methods.