Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.IO
Synopsis
- readByteStringFile :: MonadIO m => File content In -> m (Either (FileError e) ByteString)
- readLazyByteStringFile :: MonadIO m => File content In -> m (Either (FileError e) ByteString)
- readTextFile :: MonadIO m => File content In -> m (Either (FileError e) Text)
- writeByteStringFileWithOwnerPermissions :: FilePath -> ByteString -> IO (Either (FileError e) ())
- writeByteStringFile :: MonadIO m => File content Out -> ByteString -> m (Either (FileError e) ())
- writeByteStringOutput :: MonadIO m => Maybe (File content Out) -> ByteString -> m (Either (FileError e) ())
- writeLazyByteStringFileWithOwnerPermissions :: File content Out -> ByteString -> IO (Either (FileError e) ())
- writeLazyByteStringFile :: MonadIO m => File content Out -> ByteString -> m (Either (FileError e) ())
- writeLazyByteStringOutput :: MonadIO m => Maybe (File content Out) -> ByteString -> m (Either (FileError e) ())
- writeTextFileWithOwnerPermissions :: File content Out -> Text -> IO (Either (FileError e) ())
- writeTextFile :: MonadIO m => File content Out -> Text -> m (Either (FileError e) ())
- writeTextOutput :: MonadIO m => Maybe (File content Out) -> Text -> m (Either (FileError e) ())
- newtype File content (direction :: FileDirection) = File {}
- data FileDirection
- type SocketPath = File Socket 'InOut
- mapFile :: (FilePath -> FilePath) -> File content direction -> File content direction
- onlyIn :: File content InOut -> File content In
- onlyOut :: File content InOut -> File content Out
- intoFile :: File content 'Out -> content -> (File content 'Out -> stream -> result) -> (content -> stream) -> result
- checkVrfFilePermissions :: File content direction -> ExceptT VRFPrivateKeyFilePermissionError IO ()
- writeSecrets :: FilePath -> [Char] -> [Char] -> (a -> ByteString) -> [a] -> IO ()
Documentation
readLazyByteStringFile :: MonadIO m => File content In -> m (Either (FileError e) ByteString) Source #
writeByteStringFileWithOwnerPermissions :: FilePath -> ByteString -> IO (Either (FileError e) ()) Source #
writeByteStringFile :: MonadIO m => File content Out -> ByteString -> m (Either (FileError e) ()) Source #
writeByteStringOutput :: MonadIO m => Maybe (File content Out) -> ByteString -> m (Either (FileError e) ()) Source #
writeLazyByteStringFileWithOwnerPermissions :: File content Out -> ByteString -> IO (Either (FileError e) ()) Source #
writeLazyByteStringFile :: MonadIO m => File content Out -> ByteString -> m (Either (FileError e) ()) Source #
writeLazyByteStringOutput :: MonadIO m => Maybe (File content Out) -> ByteString -> m (Either (FileError e) ()) Source #
writeTextFileWithOwnerPermissions :: File content Out -> Text -> IO (Either (FileError e) ()) Source #
writeTextOutput :: MonadIO m => Maybe (File content Out) -> Text -> m (Either (FileError e) ()) Source #
newtype File content (direction :: FileDirection) Source #
A file path with additional type information to indicate what the file is meant to contain and whether it is to be used for reading or writing.
Instances
Eq (File content direction) Source # | |
Ord (File content direction) Source # | |
Defined in Cardano.Api.IO.Base Methods compare :: File content direction -> File content direction -> Ordering Source # (<) :: File content direction -> File content direction -> Bool Source # (<=) :: File content direction -> File content direction -> Bool Source # (>) :: File content direction -> File content direction -> Bool Source # (>=) :: File content direction -> File content direction -> Bool Source # max :: File content direction -> File content direction -> File content direction Source # min :: File content direction -> File content direction -> File content direction Source # | |
Read (File content direction) Source # | |
Show (File content direction) Source # | |
IsString (File content direction) Source # | |
Defined in Cardano.Api.IO.Base Methods fromString :: String -> File content direction Source # | |
FromJSON (File content direction) Source # | |
Defined in Cardano.Api.IO.Base Methods parseJSON :: Value -> Parser (File content direction) # parseJSONList :: Value -> Parser [File content direction] # omittedField :: Maybe (File content direction) # | |
ToJSON (File content direction) Source # | |
Defined in Cardano.Api.IO.Base |
data FileDirection Source #
intoFile :: File content 'Out -> content -> (File content 'Out -> stream -> result) -> (content -> stream) -> result Source #
Given a way to serialise a value and a way to write the stream to a file, serialise a value into a stream, and write it to a file.
Whilst it is possible to call the serialisation and writing functions separately, doing so means the compiler is unable to match the content type of the file with the type of the content being serialised.
Using this function ensures that the content type of the file always matches with the content value and prevents any type mismatches.
checkVrfFilePermissions :: File content direction -> ExceptT VRFPrivateKeyFilePermissionError IO () Source #