I have a function that returns me IO (Map.Map String Double)
and I need Map.Map String Double
, without IO.
I tried to do this, but it fails with: Not in scope: data constructor `IO'.
extractIO (IO (a)) = a
You can't just unwrap IO, that's the entire point of IO.
If you have an IO (Map.Map String Double) and you want to process that thing, you have to do it within monadic context, i.e.
stuff :: IO ()
stuff = do
map <- theThingThatReturnsYourIOMap
theThingThatNeedsYourUnwrappedMap map
If you explain in more detail what you want to do, we can give you a more detailed answer.
http://cvs.haskell.org/Hugs/pages/libraries/base/System-IO-Unsafe.html
unsafePerformIO
But it's a bad idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With