withOutput idx s f = withPort stdout apply idx s f
 where
   apply (ScmOutput h) = f h
   apply _             = const.return$ notOutput s
withOutput idx s f = withPort stdout apply idx s f
 where
   apply (ScmOutput h) = f h
   apply _             = const.return$ notOutput s
withOutput idx s f = withPort stdout apply idx s f
 where
   apply (ScmOutput h) = f h
   apply _             = const.return$ notOutput s