morley-1.15.1: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Michelson.Runtime.Import

Synopsis

Read, parse, typecheck contract

readContract :: forall cp st. Each '[SingI] [cp, st] => FilePath -> Text -> Either ImportContractError (Contract cp st) Source #

Purely read a typed contract from Michelson textual representation, failing if parameter or storage types mismatch with the expected ones.

readSomeContract :: FilePath -> Text -> Either ImportContractError SomeContract Source #

Purely read a typed contract from Michelson textual representation.

readUntypedContract :: FilePath -> Text -> Either ImportContractError Contract Source #

Purely read an untyped contract from Michelson textual representation.

FilePath is accepted solely as a hint for error messages.

importContract :: forall cp st. Each '[SingI] [cp, st] => FilePath -> IO (Contract cp st) Source #

Import contract from a given file path.

This function reads file, parses and type checks a contract. Within the typechecking we assume that no contracts are originated, otherwise a type checking error will be caused.

This function may throw IOException and ImportContractError.

importSomeContract :: FilePath -> IO SomeContract Source #

Version of importContract that doesn't require you to know contract's parameter and storage types.

importUntypedContract :: FilePath -> IO Contract Source #

Import untyped contract from a given file path.

This function reads file, and parses a contract.

This function may throw IOException and ImportContractError.

Read, parse, typecheck value

readValue :: forall t. SingI t => FilePath -> Text -> Either ImportValueError (Value t) Source #

Purely read a typed Michelson value from textual representation.

importValue :: forall t. SingI t => FilePath -> IO (Value t) Source #

Import a typed value from a given file path.

importSomeValue :: Ty -> FilePath -> IO SomeValue Source #

Import a typed value from a given file path.

Expected type is provided explicitly.

importUntypedValue :: FilePath -> IO Value Source #

Import an untyped value from a given file path.

Generic helpers

importUsing :: Exception e => (FilePath -> Text -> Either e a) -> FilePath -> IO a Source #

Read a thing from a file, using the provided parsing function.