Pergunta

HTML5 introduced a standard file API. Does GHCJS give access to that? Can I use the standard Haskell IO facilities in System.IO?

Foi útil?

Solução

I don't think it is possible to implement standard System.IO facilities using the HTML5 file api.

Here are some things that are possible with System.IO, but aren't possible with the HTML5 File API:

  • Writing files
  • Reading arbitrary files. In fact, there is no way to get any identifier for a file, the only way to get access to a file is by letting the user select the file in some way. There is no way to refer to a file by name.
  • Any operations on directories

As you can see, the HTML5 file API can pretty much only be used to upload files, and not to implement standard haskell System.IO actions. The only thing you could do is provide a way to get a Handle by letting the user select a file, and then provide hRead for that handle (but that's the only operation you can provide).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top