lorentz-0.2.0: src/Lorentz/Print.hs
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
-- | Printing lorentz contracts.
module Lorentz.Print
( printLorentzValue
, printLorentzContract
) where
import Lorentz.Base
import Lorentz.Constraints
import Lorentz.Run
import Michelson.Printer (printTypedFullContract, printTypedValue)
import Michelson.Typed (toVal)
-- | Pretty-print a Haskell value as Michelson one.
printLorentzValue
:: forall v.
(NicePrintedValue v)
=> Bool -> v -> LText
printLorentzValue forceSingleLine =
withDict (nicePrintedValueEvi @v) $
printTypedValue forceSingleLine . toVal
-- | Pretty-print a Lorentz contract into Michelson code.
printLorentzContract
:: forall cp st.
(NiceParameterFull cp, NiceStorage st)
=> Bool -> ContractCode cp st -> LText
printLorentzContract forceSingleLine =
printTypedFullContract forceSingleLine . compileLorentzContract