seagreen
seagreen

Reputation: 179

How do I get the contents of a URI that uses the `file` protocol in Haskell?

How can I write a function of the type Text -> IO (Maybe ByteString) where the argument to Text is a URI that uses the file protocol, e.g. file://foo/bar?

Upvotes: 1

Views: 97

Answers (1)

Sibi
Sibi

Reputation: 48746

You can achieve what you want using the package download. But note that the type signature is little different than what you wanted:

openURI :: String -> IO (Either String ByteString) 

The first String parameter denotes url which can be FTP, HTTP or a file protocol. Note that this package doesn't support HTTPS protocol.

Upvotes: 1

Related Questions