procedures :: [(String, ScmValue)]
procedures = map (\(a,b) -> (a, ScmFunc a b))
   [ ("port?",                return .  fmap ScmBool .  scmIsPort)
   , "input-port?"  $< id &&& return .: fmap ScmBool .: scmIsInputPort
   , "output-port?" $< id &&& return .: fmap ScmBool .: scmIsOutputPort

   , ("eof-object?", return . fmap ScmBool . scmIsEof)

   , "call-with-input-file"  $< id &&& scmCallWithFile  ReadMode ScmInput
   , "call-with-output-file" $< id &&& scmCallWithFile WriteMode ScmOutput

   , "current-input-port"  $< id &&& flip constant (return $ ScmInput  stdin)
   , "current-output-port" $< id &&& flip constant (return $ ScmOutput stdout)

   , "open-input-file"  $< id &&& scmOpenFile  ReadMode ScmInput
   , "open-output-file" $< id &&& scmOpenFile WriteMode ScmOutput

   , ("close-input-port",  scmCloseInputPort)
   , ("close-output-port", scmCloseOutputPort)

   , "read"       $< id &&& \s -> withInput 0 s (constant s . scmRead)
   , "read-char"  $< id &&& \s -> withInput 0 s (constant s . scmReadChar)
   , "peek-char"  $< id &&& \s -> withInput 0 s (constant s . scmPeekChar)
   , "char-ready" $< id &&& \s -> withInput 0 s (constant s . scmCharReady)

   , "write"      $< id &&& \s -> withOutput 1 s scmWrite
   , "display"    $< id &&& \s -> withOutput 1 s scmDisplay
   , "newline"    $< id &&& \s -> withOutput 0 s (constant s . scmNewline)
   , "write-char" $< id &&& \s -> withOutput 1 s scmWriteChar
   ]
procedures :: [(String, ScmValue)]
procedures = map (\(a,b) -> (a, ScmFunc a b))
   [ ("port?",                return .  fmap ScmBool .  scmIsPort)
   , "input-port?"  $< id &&& return .: fmap ScmBool .: scmIsInputPort
   , "output-port?" $< id &&& return .: fmap ScmBool .: scmIsOutputPort

   , ("eof-object?", return . fmap ScmBool . scmIsEof)

   , "call-with-input-file"  $< id &&& scmCallWithFile  ReadMode ScmInput
   , "call-with-output-file" $< id &&& scmCallWithFile WriteMode ScmOutput

   , "current-input-port"  $< id &&& flip constant (return $ ScmInput  stdin)
   , "current-output-port" $< id &&& flip constant (return $ ScmOutput stdout)

   , "open-input-file"  $< id &&& scmOpenFile  ReadMode ScmInput
   , "open-output-file" $< id &&& scmOpenFile WriteMode ScmOutput

   , ("close-input-port",  scmCloseInputPort)
   , ("close-output-port", scmCloseOutputPort)

   , "read"       $< id &&& \s -> withInput 0 s (constant s . scmRead)
   , "read-char"  $< id &&& \s -> withInput 0 s (constant s . scmReadChar)
   , "peek-char"  $< id &&& \s -> withInput 0 s (constant s . scmPeekChar)
   , "char-ready" $< id &&& \s -> withInput 0 s (constant s . scmCharReady)

   , "write"      $< id &&& \s -> withOutput 1 s scmWrite
   , "display"    $< id &&& \s -> withOutput 1 s scmDisplay
   , "newline"    $< id &&& \s -> withOutput 0 s (constant s . scmNewline)
   , "write-char" $< id &&& \s -> withOutput 1 s scmWriteChar
   ]
procedures = map (\(a,b) -> (a, ScmFunc a b))
   [ ("port?",                return .  fmap ScmBool .  scmIsPort)
   , "input-port?"  $< id &&& return .: fmap ScmBool .: scmIsInputPort
   , "output-port?" $< id &&& return .: fmap ScmBool .: scmIsOutputPort

   , ("eof-object?", return . fmap ScmBool . scmIsEof)

   , "call-with-input-file"  $< id &&& scmCallWithFile  ReadMode ScmInput
   , "call-with-output-file" $< id &&& scmCallWithFile WriteMode ScmOutput

   , "current-input-port"  $< id &&& flip constant (return $ ScmInput  stdin)
   , "current-output-port" $< id &&& flip constant (return $ ScmOutput stdout)

   , "open-input-file"  $< id &&& scmOpenFile  ReadMode ScmInput
   , "open-output-file" $< id &&& scmOpenFile WriteMode ScmOutput

   , ("close-input-port",  scmCloseInputPort)
   , ("close-output-port", scmCloseOutputPort)

   , "read"       $< id &&& \s -> withInput 0 s (constant s . scmRead)
   , "read-char"  $< id &&& \s -> withInput 0 s (constant s . scmReadChar)
   , "peek-char"  $< id &&& \s -> withInput 0 s (constant s . scmPeekChar)
   , "char-ready" $< id &&& \s -> withInput 0 s (constant s . scmCharReady)

   , "write"      $< id &&& \s -> withOutput 1 s scmWrite
   , "display"    $< id &&& \s -> withOutput 1 s scmDisplay
   , "newline"    $< id &&& \s -> withOutput 0 s (constant s . scmNewline)
   , "write-char" $< id &&& \s -> withOutput 1 s scmWriteChar
   ]