io.km 635 B

123456789101112131415161718192021222324252627282930313233
  1. module I/O;
  2. type InputStream native;
  3. type OutputStream native;
  4. type Error {
  5. message: String
  6. };
  7. public function read {
  8. lambda(InputStream) Effect*[Bytes,Error]:
  9. native 'read'
  10. };
  11. public function write {
  12. lambda(OutputStream, Effect*[Bytes,Error]) Effect[(),Error]:
  13. native 'write'
  14. };
  15. public function write-bytes {
  16. lambda(OutputStream, Bytes) Effect[(),Error]:
  17. native 'write-bytes'
  18. };
  19. public function write-string {
  20. lambda(OutputStream, String) Effect[(),Error]:
  21. native 'write-string'
  22. };
  23. public function write-line {
  24. lambda(OutputStream, String) Effect[(),Error]:
  25. native 'write-line'
  26. };