Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- readContract :: forall cp st. Each '[SingI] [cp, st] => MichelsonSource -> Text -> Either ContractReadError (Contract cp st)
- readSomeContract :: MichelsonSource -> Text -> Either ContractReadError SomeContract
- readUntypedContract :: MichelsonSource -> Text -> Either ContractReadError Contract
- importContract :: forall cp st. Each '[SingI] [cp, st] => FilePath -> IO (Contract cp st)
- importSomeContract :: FilePath -> IO SomeContract
- importUntypedContract :: FilePath -> IO Contract
- data ContractReadError
- readValue :: forall t. SingI t => MichelsonSource -> Text -> Either ValueReadError (Value t)
- importValue :: forall t. SingI t => FilePath -> IO (Value t)
- importSomeValue :: Ty -> FilePath -> IO SomeValue
- importUntypedValue :: FilePath -> IO Value
- data ValueReadError
- data MichelsonSource where
- MSFile FilePath
- MSName Text
- MSCode SrcLoc
- MSUnspecified
- pattern MSStdin :: MichelsonSource
- pattern MSCli :: MichelsonSource
- importUsing :: Exception e => (MichelsonSource -> Text -> Either e a) -> FilePath -> IO a
Read, parse, typecheck contract
readContract :: forall cp st. Each '[SingI] [cp, st] => MichelsonSource -> Text -> Either ContractReadError (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 :: MichelsonSource -> Text -> Either ContractReadError SomeContract Source #
Purely read a typed contract from Michelson textual representation.
readUntypedContract :: MichelsonSource -> Text -> Either ContractReadError Contract Source #
Purely read an untyped contract from Michelson textual representation.
MichelsonSource
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 ContractReadError
.
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 ContractReadError
.
data ContractReadError Source #
Error type for importContract
function.
Instances
Exception ContractReadError Source # | |
Show ContractReadError Source # | |
Defined in Morley.Michelson.Runtime.Import showsPrec :: Int -> ContractReadError -> ShowS # show :: ContractReadError -> String # showList :: [ContractReadError] -> ShowS # | |
Buildable ContractReadError Source # | |
Defined in Morley.Michelson.Runtime.Import build :: ContractReadError -> Builder # | |
Eq ContractReadError Source # | |
Defined in Morley.Michelson.Runtime.Import (==) :: ContractReadError -> ContractReadError -> Bool # (/=) :: ContractReadError -> ContractReadError -> Bool # |
Read, parse, typecheck value
readValue :: forall t. SingI t => MichelsonSource -> Text -> Either ValueReadError (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.
data ValueReadError Source #
Error type for importValue
function.
Instances
Exception ValueReadError Source # | |
Defined in Morley.Michelson.Runtime.Import | |
Show ValueReadError Source # | |
Defined in Morley.Michelson.Runtime.Import showsPrec :: Int -> ValueReadError -> ShowS # show :: ValueReadError -> String # showList :: [ValueReadError] -> ShowS # | |
Buildable ValueReadError Source # | |
Defined in Morley.Michelson.Runtime.Import build :: ValueReadError -> Builder # | |
Eq ValueReadError Source # | |
Defined in Morley.Michelson.Runtime.Import (==) :: ValueReadError -> ValueReadError -> Bool # (/=) :: ValueReadError -> ValueReadError -> Bool # |
Generic helpers
data MichelsonSource Source #
Where a contract or value in Michelson comes from.
MSFile FilePath | From given file. |
MSName Text | Only source name is known. |
MSCode SrcLoc | Defined in Haskell code. |
MSUnspecified | Some unknown source. |
pattern MSStdin :: MichelsonSource | Designates |
pattern MSCli :: MichelsonSource | Designates command line input source. |
Instances
IsString MichelsonSource Source # | |
Defined in Morley.Michelson.Parser.Types fromString :: String -> MichelsonSource # | |
Show MichelsonSource Source # | |
Defined in Morley.Michelson.Parser.Types showsPrec :: Int -> MichelsonSource -> ShowS # show :: MichelsonSource -> String # showList :: [MichelsonSource] -> ShowS # | |
Buildable MichelsonSource Source # | |
Defined in Morley.Michelson.Parser.Types build :: MichelsonSource -> Builder # | |
Eq MichelsonSource Source # | |
Defined in Morley.Michelson.Parser.Types (==) :: MichelsonSource -> MichelsonSource -> Bool # (/=) :: MichelsonSource -> MichelsonSource -> Bool # |
importUsing :: Exception e => (MichelsonSource -> Text -> Either e a) -> FilePath -> IO a Source #
Read a thing from a file, using the provided parsing function.