
Hi, I want to implement a function in C++ via Haskell FFI, which should have the (final) type of String -> String. Say, is it possible to re-implement the following function in C++ with the exact same signature? import Data.Char toUppers:: String -> String toUppers s = map toUpper senter code here In particular, I wanted to avoid having an IO in the return type because introducing the impurity (by that I mean the IO monad) for this simple task is logically unnecessary. All examples involing a C string I have seen so far involve returning an IO something or Ptr which cannot be converted back to a pure String. The reason I want to do this is that I have the impression that marshaling is not easy with FFI. Maybe if I can fix the simplest case above (other than primitive types such as int), then I can do whatever data parsing I want on the C++ side, which should be easy, practically. The cost of parsing is negligible compared to the computation that I want to do between the marshalling to/from strings. Thanks in advance.