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