cardano-api:internal
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.IO

Synopsis

Documentation

readTextFile :: MonadIO m => File content 'In -> m (Either (FileError e) Text) Source #

writeTextFile :: MonadIO m => File content 'Out -> Text -> m (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.

Constructors

File 

Fields

Instances

Instances details
FromJSON (File content direction) Source # 
Instance details

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 # 
Instance details

Defined in Cardano.Api.IO.Base

Methods

toJSON :: File content direction -> Value #

toEncoding :: File content direction -> Encoding #

toJSONList :: [File content direction] -> Value #

toEncodingList :: [File content direction] -> Encoding #

omitField :: File content direction -> Bool #

IsString (File content direction) Source # 
Instance details

Defined in Cardano.Api.IO.Base

Methods

fromString :: String -> File content direction Source #

Read (File content direction) Source # 
Instance details

Defined in Cardano.Api.IO.Base

Methods

readsPrec :: Int -> ReadS (File content direction) Source #

readList :: ReadS [File content direction] Source #

readPrec :: ReadPrec (File content direction) Source #

readListPrec :: ReadPrec [File content direction] Source #

Show (File content direction) Source # 
Instance details

Defined in Cardano.Api.IO.Base

Methods

showsPrec :: Int -> File content direction -> ShowS Source #

show :: File content direction -> String Source #

showList :: [File content direction] -> ShowS Source #

Eq (File content direction) Source # 
Instance details

Defined in Cardano.Api.IO.Base

Methods

(==) :: File content direction -> File content direction -> Bool Source #

(/=) :: File content direction -> File content direction -> Bool Source #

Ord (File content direction) Source # 
Instance details

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 #

data FileDirection Source #

Constructors

In

Indicate the file is to be used for reading.

Out

Indicate the file is to be used for writing.

InOut

Indicate the file is to be used for both reading and writing.

mapFile :: forall content (direction :: FileDirection). (FilePath -> FilePath) -> File content direction -> File content direction Source #

onlyIn :: File content 'InOut -> File content 'In Source #

onlyOut :: File content 'InOut -> File content 'Out 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 :: forall content (direction :: FileDirection). File content direction -> ExceptT VRFPrivateKeyFilePermissionError IO () Source #

writeSecrets :: FilePath -> [Char] -> [Char] -> (a -> ByteString) -> [a] -> IO () Source #