implement IO commands

and remove the Maybes. And add a custom function for reading
stdin, because getContents closes it.
This is still a pretty lame implementation. It still doesn't do any
error checking, and it's terribly slow, probably because of list
lookups are O(n). Using a more efficient data structure should
speed things up considerably.