I am using the listings package to typeset some code. I've defined a lstlisting environment, based upon the standard Haskell environment, and added a number of literate replacements, including:
literate={->}{{$\rightarrow{}$}}2
When the symbol -> appears in a listing environment, my spacing around the symbol is preserved. However, when it appears in an inline listing, the space after the \rightarrow gets eaten, resulting in T a -> a -> a looking like T a ->a -> a. Does anyone know how I can avoid this behavior in the inline listings without also confusing the listing environment?

\documentclassand the appropriate packages so that those trying to help don't have to recreate it. I realize that it does not sound too complicated in this case, but any time you can save of those trying to help would be appreciated. – Peter Grill Feb 22 '12 at 5:45