Hello i was wondering how can you unwrap a value at a later time in the IO monad?
If a<-expression
binds the result to a
then can't i use (<-expression)
as a parameter for a given method eg:
method (<-expression)
where method method
accepts the result of the evaluation?
Code
let inh=openFile "myfile" WriteMode
let outh=openFile "out.txt" WriteMode
hPutStrLn (<-outh) ((<-inh)>>=getLine)
I have not entered the Monad
chapter just basic <-
and do
blocks but i suppose it has to do with monads.
Then if i want to pass the result
if the evaluation to hGetLine
can't i use something like:
(<-expression)=>>hGetLine