myGetChar :: ProcessHandle -> Handle -> IO MaybeChar
myGetChar cp h = do
  mc <- catchIOException Wait (fmap JustChar $ hGetChar h)
  case mc of
    Wait -> do
      ms <- getProcessExitCode cp
      return $ case ms of
        Nothing -> mc
        Just _ -> Stop
    _ -> return mc
myGetChar :: ProcessHandle -> Handle -> IO MaybeChar
myGetChar cp h = do
  mc <- catchIOException Wait (fmap JustChar $ hGetChar h)
  case mc of
    Wait -> do
      ms <- getProcessExitCode cp
      return $ case ms of
        Nothing -> mc
        Just _ -> Stop
    _ -> return mc
myGetChar cp h = do
  mc <- catchIOException Wait (fmap JustChar $ hGetChar h)
  case mc of
    Wait -> do
      ms <- getProcessExitCode cp
      return $ case ms of
        Nothing -> mc
        Just _ -> Stop
    _ -> return mc