On 08/12/2009 03:54, Bas van Dijk wrote:
Could not get to sleep tonight so I got up and hacked this together:
Does something like this already exist on hackage:
If not, I may turn this into a package and upload it tomorrow.
Comments, criticism and patches are welcome.
I like this idea.
A small observation, though:
stdin :: ReadModes ioMode => Handle ioMode
stdin = Handle SIO.stdin
This allows writing to stdin by choosing ReadWriteMode as the ioMode. I think
it would be better to have just
stdin :: Handle ReadMode
*HandleExplicitIOMode> hPutStrLn (stdin :: Handle ReadWriteMode) "This shouldn't
*** Exception: <stdin>: hPutStr: illegal operation (handle is not open for
This also shows another reason for stdin, stdout and stderr to be monomorphic:
Ambiguous type variable `ioMode' in the constraint:
arising from a use of `hGetLine' at <interactive>:1:0-13
Probable fix: add a type signature that fixes these type variable(s)
Haskell-Cafe mailing list