Reputation: 179
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
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