h&u!            ! " # $ % & '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   !!!!!!!!!!!!!!!!!!!! "###########################$$$$$$$$$$$$$$$%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'''(((((((((((((((((((())***+++++++++++++,,,,,                                                  -----------------------------------------------------------------------..............................//////////////////////////// / / / / / / / / / / / / / / / / / / / / / / / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : ::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<<<<=================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>????@@@ABBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQQQQQQQQQQQQQRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVVVWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXXXXXXXXXXXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZZZZZZ[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\]]^_____________```````````````aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeffffffffffffffggggggghhhhhijjjjjjjjjjjjkklllmmmmmmmmmmnnnnnnnnoooo          ppqqqqrrrrrrrrrrrsssssssssssssssssssssssssssssssssssstttuuuuuvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x y y y y y y y z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!z!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|!|None8 "#$%&'(+-./12356789:<=>?T3morleyBuild a binary representation of a Zarith natural. This function is partial, only defined for nonnegative !s.(The reason it's not defined to accept a ! is mostly to avoid !/! conversions at the use sites, since not all libraries, notably  cryptonite , support !.-./0123456789:-./0523419768:None8 "#$%&'(+-./12356789:<=>?U;morley#Encode a number as tezos does this.>In the Tezos reference implementation this encoding is called zarith.;;None8 "#$%&'(+-./12356789:<=>?]<morleyA new type that can wrap values so that the RenderDoc instances of the combined value can have a different behavior for the pretty printer.>morleyGeneralize converting a type into a Text.PrettyPrint.Leijen.Text.Doc. Used to pretty print Michelson code and define Fmt.Buildable instances.@morleyWhether a value can be represented in Michelson code. Normally either all values of some type are renderable or not renderable. However, in case of instructions we have extra instructions which should not be rendered. Note: it's not sufficient to just return ! for such instructions, because sometimes we want to print lists of instructions and we need to ignore them complete (to avoid putting redundant separators).Amorley/Environment carried during recursive rendering.BmorleyRenders a list of > elements surrounded with square brackets, separated by a comma and a space.DmorleyConvert ! to ! with a line width of 80.EmorleyConvert ! to ! in the same manner as D.FmorleyConvert ! to ! in the same manner as D.GmorleyGeneric way to render the different op types that get passed to a contract.Hmorley0Render a comma-separated list of items in bracesImorley5Render a comma-separated list of items without bracesJmorley#Create a specific number of spaces.KmorleyWrap documents in parentheses if there are two or more in the list.Lmorley#Turn something that is instance of > into a !". It's formatted the same way as D formats docs.Mmorley Works as L; above, but doesn't force the doc to be printed in one lineNmorleyConstructors for AOmorleyConstructors for APmorleyAdd parentheses if needed.QmorleyEnsure parentheses are not required, for case when you cannot sensibly wrap your expression into them.<=>?@ABCDEFGHIJKLMNOPQ>?@<=DEFGHICJKLMBANOPQNone8 "#$%&'(+-./12356789:<=>?`yRmorleyPath to a leaf (some field or constructor) in generic tree representation.SmorleyWhich branch to choose in generic tree representation: left, straight or right. U is used when there is one constructor with one field (something newtype-like).The reason why we need U can be explained by this example: data A = A1 B | A2 Integer data B = B Bool Now we may search for A1 constructor or B constructor. Without U, in both cases path will be the same ([L]).RSVUTSVUTRNone8 "#$%&'(+-./12356789:<=>?dWmorleyThis type family checks that field descriptions mention only existing constructors and fields.When descr is empty this family does nothing, to avoid breaking for built-in, non-ADT types.When descr' is not empty, this family will demand ! instance for typ and fail with a  if there none.XmorleyValue-level counterpart to Y.Ymorley8Description of constructors and fields of some datatype.This type is just two nested maps represented as associative lists. It is supposed to be interpreted like this: [(Constructor name, (Maybe constructor description, [(Field name, Field description)]))]"Example with a concrete data type: data Foo = Foo { fFoo :: Int } | Bar { fBar :: Text } deriving (Generic) type FooDescriptions = '[ '( "Foo", '( 'Just "foo constructor", , '[ '("fFoo", "some number") ]) ) , '( "Bar", '( 'Nothing, , '[ '("fBar", "some string") ]) ) ]WXYYXWNone8 "#$%&'(+-./12356789:<=>?hyZmorleyCompute a cryptographic hash of a bytestring using the Blake2b_256 cryptographic hash function. It's used by the BLAKE2B instruction in Michelson.[morleyCompute a cryptographic hash of a bytestring using the Blake2b_160 cryptographic hash function.\morleyCompute a cryptographic hash of a bytestring using the Sha256 cryptographic hash function.]morleyCompute a cryptographic hash of a bytestring using the Sha512 cryptographic hash function.^morleyCompute a cryptographic hash of a bytestring using the Sha3_256 cryptographic hash function. It is used by the SHA3 Michelson instruction._morleyCompute a cryptographic hash of a bytestring using the Keccak_256 cryptographic hash function. It is used by the KECCAK Michelson instruction.Z[\]^_Z[_\^]None8 "#$%&'(+-./12356789:<=>?iV`morleyOptions that we use in morley-based packages (including morley ) by default.``None8 "#$%&'(+-./12356789:<=>?*)amorley*Field annotation for the entire parameter.bmorley!A convenience synonym for "some" s*, i.e. its type is unknown at compile-timecmorley#A convenience synonym for variable sdmorley A convenience synonym for field semorleyA convenience synonym for type sfmorley'Type-level tag for variable annotationsgmorley$Type-level tag for field annotationshmorley#Type-level tag for type annotationsimorleyA constraint representing that type-level annotation tag is known at compile-timejmorleyWhat prefix is used for the given annotation type (identified by tag) in Michelson code, i.e. % for field annotations, @ for variable annotations, : for type annotationskmorleyAn k contains all the typefield variable ss , with each group in order, associated with an entity. Note that in its rendering/show instances the unnecessary annotations will be omitted, as well as in some of the functions operating with it. Necessary ss are the ones strictly required for a consistent representation. In particular, for each group (tf v): - if all annotations are * they are all omitted - if one or more  follow a non-empty s', they are omitted - if one or more  precede a non-empty s%, they are kept - every non-empty s is obviously kept This is why order for each group is important as well as separation of different groups of ss.pmorley&Either one or two variable annotationssmorley Generic TypeFieldVariable AnnotationAs per Michelson documentation, this type has an invariant: (except for the first character, here parametrized in the type tag) the allowed character set is the one matching the following regexp: %|%%|%|[:%][_0-9a-zA-Z][_0-9a-zA-Z.%@]*vmorleyUnidirectional pattern synonym matching only non-empty annotationswmorley8Unidirectional pattern synonym used to pattern-match on s without invoking txmorleyAn k without any s.ymorleyAn k with only a single s (of any kind).zmorleyAn k with several ss of the same kind.{morleyAn k built from all 3 kinds of s.|morleyReturns ! if all ss in the Set are unnecessaryempty. False otherwise.}morleyReturns the amount of s;s that are necessary for a consistent representation. See k.~morleyRemoves all unnecessary ss. See k.morley%Returns the number of annotations in k for each type.morleyReturns the first annotation in a list of annotations of a specific type in k, or  if this list is empty.morleyReturns the second annotation in a list of annotations of a specific type in k, or , if this list contains less than 2 elements.morleyEmpty s, i.e. no annotationmorley Makes an s" from its textual value, prefix (%@*:) excluded Throws an error if the given ! contains invalid charactersmorley Makes an s" from its textual value, prefix (%@:) excluded Returns a ! error message if the given ! contains invalid charactersmorley:t [annQ|abc|]*... :: forall k (tag :: k). Annotation tagmorley:t [typeAnnQ|abc|]...... :: TypeAnnmorley:t [fieldAnnQ|abc|]...... :: FieldAnnmorley:t [varAnnQ|abc|]... ... :: VarAnnmorley>List of all the special Variable Annotations, only allowed in CAR and CDR instructions, prefix (@) excluded. These do not respect the rules of  and .morley3The only special Field Annotation, only allowed in PAIR, LEFT and RIGHT instructions, prefix (%) excluded. This does not respect the rules of  and .morley Checks if a !6 is valid to be the first of an annotation, prefix (%@8:) excluded, the ones following should be checked with  instead. Note that this does not check Special Annotations, see  and morley Checks if a ! is valid to be part of an annotation, following a valid first character (see ) and the prefix (%@<:). Note that this does not check Special Annotations, see  and morleyReturns the first annotation if it's not empty, or the second one otherwise. "a" `orAnn` "b" == "a" "a" `orAnn` "" == "a" "" `orAnn` "b" == "b" "" `orAnn` "" == ""morleyGiven two type or field annotations, attempt to converge them by joining these annotations with the following rule: 1. If either annotation is empty, an empty annotation is returned; 2. If both annotations are equal, return this annotation; 3. Otherwise, returns !.This function is used primarily for type-checking and attempts to imitate the reference implementation's observed behavior with annotations.morleyGiven two field annotations where one of them is used in CAR or CDR, attempt to converge them by joining these annotations with the following rule: 1. If either annotation is empty, return the non-empty one (or empty if both are empty); 2. If both annotations are equal, return this annotation; 3. Otherwise, returns !.This function is used primarily for type-checking and attempts to imitate the reference implementation's observed behavior with field annotations when CAR and CDR are used with pairs.morleyKeeps an annotation if and only if the two of them are equal and returns an empty annotation otherwise.morley+Convert annotation from one type to another2abcdefghijklmnopqrstuvwxyz{|}~2stupqrwvklmnox{|}yz~ijedcbahgfNone8 "#$%&'(+-./12356789:<=>?morleyMichelson Typemorley>Since Babylon parameter type can have special root annotation.morley,Annotated Michelson type. We don't name it ! to avoid conflicts with }~.morley2Extract a raw Michelson type from an annotated onemorleyRender a type representationOrdering between different kinds of annotations is not significant, but ordering among annotations of the same kind is. Annotations of a same kind must be grouped together. (prim @v :t %x arg1 arg2 ...)these are equivalent -PAIR :t @my_pair %x %y PAIR %x %y :t @my_pairmorleyConstruct non-annotated option type from an annotated typemorleyConstruct non-annotated pair type from two annotated typesmorleyConstruct non-annotated or type from two annotated typesmorleyConstruct annotated int type with an empty annotationmorleyConstruct annotated nat type with an empty annotationmorleyConstruct annotated unit type with an empty annotationmorleyConstruct annotated bool type with an empty annotationmorleyConstruct annotated pair type with an empty annotationmorleyConstruct annotated or type with an empty annotationmorleyFor implicit account, which Ty its parameter seems to have from outside.morleyCheck if type is atomic.morleyPredicate checking if type is keymorleyPredicate checking if type is  signaturemorley8Predicate checking if type is comparable, i.e. true for int, nat, string , etc. see  ,https://tezos.gitlab.io/michelson-reference/) for a complete list of comparable types.morleyPredicate checking if type is mutezmorleyPredicate checking if type is  timestampmorleyPredicate checking if type is keyhashmorleyPredicate checking if type is boolmorleyPredicate checking if type is stringmorley-Predicate checking if type is integral, i.e. nat, int, mutez, or  timestampmorleyPredicate checking if type is natmorleyPredicate checking if type is intmorleyPredicate checking if type is bytes<<None8 "#$%&'(+-./12356789:<=>?morleyAn inline test assertionmorley!A comment with optional embedded  s. Used with PRINT extended instruction.morley8A stack function that expresses the type signature of a LetMacromorleyA stack pattern-matchmorley"A type-variable or a type-constantmorleyA (named) type variablemorleyA reference into the stack.morley3Implementation-specific instructions embedded in a NOP primitive, which mark a specific point during a contract's typechecking or execution.These instructions are not allowed to modify the contract's stack, but may impose additional constraints that can cause a contract to report errors in type-checking or testing.Additionaly, some implementation-specific language features such as type-checking of LetMacro6s are implemented using this mechanism (specifically FN and FN_END).morley,Matches current stack against a type-patternmorley'A typed stack function (push and pop a  TcExtFrame)morley8Copy the current stack and run an inline assertion on itmorley'Print a comment with optional embedded StackRefsmorleyA comment in Michelson codemorleyConvert # to a list of types. Also returns ! which is !. if the pattern is a fixed list of types and !2 if it's a pattern match on the head of the stack.morley+Get the set of variables in a stack pattern  None8 "#$%&'(+-./12356789:<=>?morley6Michelson language type with annotations stripped off.morleyConverts from  to .morley"Format type stack in a pretty way.!!None8 "#$%&'(+-./12356789:<=>?None8 "#$%&'(+-./12356789:<=>?morleyDescribes how  should decode tag-dependent data. We expect bytes of such structure: 5 followed by a bytestring which will be parsed with .morleyAny decoding error.morley Alias for  constructor.morleyGet a bytestring of the given length leaving no references to the original data in serialized form.morleyGet remaining available bytes.Note that reading all remaining decoded input may be expensive and is thus discouraged, use can use this function only when you know that amount of data to be consumed is limited, e.g. within  call.morleyFail with "unknown tag" error.0None8 "#$%&'(+-./12356789:<=>?morleyError that can happen during parsing of cryptographic primitive types.morley*Encode a bytestring in Base58Check format.morley,Decode a bytestring from Base58Check format.morleyParse a base58check encoded value expecting some prefix. If the actual prefix matches the expected one, it's stripped of and the resulting payload is returned.morley!Template for 'format*' functions.morley Template for 'parse*' functions.morleyReturns first encountered !2 in a list. If there are none, returns arbitrary !%. It is useful to implement parsing.morley*Do randomized action using specified seed.morleyMake a ! from raw bytes.Raw bytes are in the format of Compressed SEC Format. Refer to this article on how this is parsed: https://www.oreilly.com/library/view/programming-bitcoin/9781492031482/ch04.htmlmorley Convert a ! to raw bytes.morley Convert a ! to raw bytes.morley Convert a ! to raw bytes.morleyMake a ! from raw bytes.morleyMake a !* from raw bytes representing a secret key.None8 "#$%&'(+-./12356789:<=>?JmorleyNewtype wrapper for ByteString which uses hexadecimal representation for JSON serialization.None8 "#$%&'(+-./12356789:<=>?None8 "#$%&'(+-./12356789:<=>?morleyIf monadic action returns a ! value, it will be thrown. Otherwise the returned value will be returned as is.None8 "#$%&'(+-./12356789:<=>?morley Similar to !, but compares types via  DefaultEq& used in singletons comparisons (see Data.Singletons.Prelude.Eq module).None8 "#$%&'(+-./12356789:<=>?morley5Extract datatype name via its Generic representation.:For polymorphic types this throws away all type arguments.morleyRebuild a list into a binary tree of exactly the same form which  Data.Generics uses to represent datatypes.Along with the original list you have to provide constructor for intermediate nodes - it accepts zero-based index of the leftmost element of the right tree and merged trees themselves. None8 "#$%&'(+-./12356789:<=>?u!None8 "#$%&'(+-./12356789:<=>?morleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quotersmorleyActual quasi-quoters None8 "#$%&'(+-./12356789:<=>?morley?For datatype with "myNyan" field it will create "myNyanL" lens."None8 "#$%&'(+-./12356789:<=>?morleySome defaults in Haskell are debatable and we typically want to customize them in our applications. Some customizations are done at the level of main!. Currently we have two of them: ! from the  with-utf8 package.! from the uncaught-exception package.'This function is supposed to apply all main- customizations that we typcally want to do.#None8 "#$%&'(+-./12356789:<=>?Omorley"Picking anchor for various things.What you want here is potentially adding some prefix to ensure anchors uniqueness. It is not necessary to preprocess the text to fit anchor format - that will happen when the anchor is embedded into .morleyAnchor with given text.morley!Level of header, starting from 1.morleyA piece of markdown document.This is opposed to ! type, which in turn is not supposed to contain markup elements.morleyTurn text into valid anchor. Human-readability is not preserved.morley#Text which is hidden until clicked.morleyQuasi quoter for Markdown. This supports interpolation via #{name} syntax.Please note that we previously supported expressions inside interpolated splices. This is no longer the case. Only literal variable names can be used. is implemented in terms of , see Morley.Util.Interpolate2 for more information on how interpolation works.$None8 "#$%&'(+-./12356789:<=>?PmorleyInteger values starting from 1.,We define our own datatype in order to have ! instance for it, which can not be derived for third-party types without exported constructor.morleyCount length of non-empty list.morley7Produce a non empty list consisting of the given value.%None8 "#$%&'(+-./12356789:<=>?morley Version of ! that uses (morleySuppose you have a data type X with parameter a and you have two values:  x1 :: X a1 and  x2 :: X a2 . You can't compare them using !, because they have different types. However, you can compare them using  as long as both parameters have SingI instances and their kind is !.morley Version of  for types with 2 parameters.morley Version of  for types with 3 parameters.morley Version of  for types with 3 parameters.&None9 "#$%&'(+-./12356789:<=>?*morleyMonadic version of >. Throws an error using the given function if the cast fails.morleyMonadic version of . Throws an error using the given function if the two types are not equal.morley Version of  that uses !morleyPreviously, we were using ( constraints in  constructors. That was not so optimal because we have been spending too much space at runtime. Instead of that, we process values of  using the function  in those places where the ( constraint is required.  allows one to create the ( context for a given .##None8 "#$%&'(+-./12356789:<=>?Ъ8morleyAllows using a scope that can be proven true with a De Morgan law.Many scopes are defined as not a (or rather  a ~ 'False) where a/ is a negative property we want to avoid as a !. The negative constraints are implemented with a type family that for some combination types resolves to itself applied to the type arguments in an or , e.g. A pair l r has x if l or r contain x.Because of the De Morgan laws  not (a or b) implies (not a) and (not b) or in our case: pair does not contain x -> a and b don't contain x.GHC is however not able to prove this, so we need to use another (impossible) ! to forcefully "prove" one of the two scopes. Funnily enough however GHC is able to prove that if one holds then the other does too, so we don't actually have to prove both, see !.morley$Should be present for common scopes.morley,Check that constraint hold for a given type.morleyAlias for constraints which are required for untyped representation.morleySet of constraints that Michelson applies to argument type and return type of views. All info related to views can be found in  https://gitlab.com/tezos/tzip/-/blob/master/drafts/current/draft_views.mdTZIP.?Not just a type alias in order to be able to partially apply itmorley=Set of constraints that Michelson applies to unpacked values.It is different from , e.g. contract- type cannot appear in a value we unpack to.?Not just a type alias in order to be able to partially apply itmorley;Set of constraints that Michelson applies to packed values.?Not just a type alias in order to be able to partially apply itmorley2Alias for constraints which Michelson requires in DUP instruction.morley>Set of constraints that Michelson applies to pushed constants.?Not just a type alias in order to be able to partially apply itmorley>Set of constraints that Michelson applies to contract storage.?Not just a type alias in order to be able to partially apply itmorley8Set of constraints that Michelson applies to parameters.?Not just a type alias in order to be able to partially apply itmorley2Whether a value of this type _may_ contain nested big_maps.morleyA value of type t may or may not contain nested big_maps.morleyA value of type t cannot contain nested big_maps.morley-Whether a value of this type _may_ contain a big_map value.morleyA value of type t may or may not contain a big_map value.morleyA value of type t cannot contain big_map values.morley-Whether a value of this type _may_ contain a ticket value.morleyA value of type t may or may not contain a ticket value.morleyA value of type t cannot contain ticket values.morley-Whether a value of this type _may_ contain a contract value.morleyA value of type t may or may not contain a contract value.morleyA value of type t cannot contain contract values.morley8Whether a value of this type _may_ contain an operation.morleyA value of type t% may or may not contain an operation.morleyA value of type t cannot contain big_map values.morleyConstraint that rises human-readable error message, in case given value can't be comparedmorley This is like ., it raises a more human-readable error when t type is concrete, but GHC cannot make any conclusions from such constraint as it can for (. Though, hopefully, it will someday:  /https://gitlab.haskell.org/ghc/ghc/issues/11503#11503. Use this constraint in our eDSL.morleyReport a human-readable error that given value is not comparablemorley#Report a human-readable error that  contains another morley$Report a human-readable error about  at a wrong place.morley$Report a human-readable error about  at a wrong place.morley$Report a human-readable error about  at a wrong place.morley$Report a human-readable error about  at a wrong place.morley:Constraint which ensures that there are no nested bigmaps.morley.Constraint which ensures that a value of type t does not contain big_map values.morley.Constraint which ensures that a value of type t does not contain ticket values.morley.Constraint which ensures that a value of type t does not contain contract values.morley.Constraint which ensures that a value of type t does not contain operations.Not just a type alias in order to be able to partially apply it (e.g. in !).morley1Constraint which ensures that type is comparable.morley2Whether a value of this type _may_ contain nested big_maps.Nested big_maps (i.e. big_map which contains another big_map inside of it's value type) are prohibited in all contexts. Some context such as PUSH, APPLY, PACK/UNPACK instructions are more strict because they don't work with big_map at all.morley-Whether a value of this type _may_ contain a big_map value.morley-Whether a value of this type _may_ contain a ticket value.morley-Whether a value of this type _may_ contain a contract value.In some scopes (constants, storage) appearing for contract type is prohibited. Contracts in input/output of lambdas are allowed without limits though.morley8Whether a value of this type _may_ contain an operation.In some scopes (constants, parameters, storage) appearing for operation type is prohibited. Operations in input/output of lambdas are allowed without limits though.morleyReify  contraint from . Left for backward compatibility.morleyReify  contraint from .morleyCheck at runtime whether a value of the given type _may_ contain an operation.morleyCheck at runtime whether a value of the given type _may_ contain a contract value.morleyCheck at runtime whether a value of the given type _may_ contain a ticket value.morleyCheck at runtime whether a value of the given type _may_ contain a big_map value.morleyCheck at runtime whether a value of the given type _may_ contain nested big_maps.morleyCheck at runtime that a value of the given type cannot contain operations.morley?Check at runtime that a value of the given type cannot contain contract values.morleyCheck at runtime that a value of the given type cannot containt big_map valuesmorleyCheck at runtime that a value of the given type cannot contain nested big_maps.('(''None8 "#$%&'(+-./12356789:<=>?Imorley)Generates an NFData instance for a GADT. Note: This will not generate additional constraints to the generated instance if those are required.morleyCheck if name is a type(None8 "#$%&'(+-./12356789:<=>?GmorleyType of a strategy to derive ! instances.morleyIn this strategy the desired depths of contructors (in the type tree) and fields (in each constructor's tree) are provided manually and simply checked against the number of actual constructors and fields.morleyStrategy to make right-balanced instances (both in constructors and fields)..This will try its best to produce a flat tree:4the balances of all leaves differ no more than by 1;leaves at left will have equal or lesser depth than leaves at right.morleyStrategy to make left-balanced instances (both in constructors and fields).)This is the same as symmetrically mapped .morleyStrategy to make fully right-leaning instances (both in constructors and fields).morleyStrategy to make fully left-leaning instances (both in constructors and fields).morleyStrategy to make Haskell's Generics-like instances (both in constructors and fields).This is similar to , except for the "flat" part:for each node, size of the left subtree is equal or less by one than size of the right subtree.This strategy matches A1.1.!customGeneric "T" haskellBalanced is equivalent to mere deriving stock Generic T.morley.Modify given strategy to reorder constructors.The reordering will take place before depths are evaluated and structure of generic representation is formed. Example: .reorderingConstrs alphabetically rightBalanced.morley(Modify given strategy to reorder fields.Same notes as for  apply here. Example: reorderingFields forbidUnnamedFields alphabetically rightBalanced.morley9Modify given strategy to reorder constructors and fields.Same notes as for  apply here. Example: ?reorderingData forbidUnnamedFields alphabetically rightBalanced.morley$Sort entries by name alphabetically.morley4Leave unnamed fields intact, without any reordering.morleyFail in case records are unnamed and we cannot figure out the necessary reordering.morleyHelper to make a strategy that created depths for constructor and fields in the same way, just from their number.The provided function f" must satisfy the following rules: length (f n) D n"sum $ (x -> 2 ^^ (-x)) <$> f n D 1 (unless n = 0)morley&Helper for making a constructor depth.Note that this is only intended to be more readable than directly using a tuple with 1 and for the ability to be used in places where RebindableSyntax) overrides the number literal resolution.morley Helper for making a field depth.Note that this is only intended to be more readable than directly using a tuple with 1 and for the ability to be used in places where RebindableSyntax) overrides the number literal resolution.morleyIf a !2 type is given, this function will generate a new ! instance with it, and generate the appropriate "to" and "from" methods. Otherwise, it'll generate a new ! instance as well.morley*Reifies info from a type name (given as a !<). The lookup happens from the current splice's scope (see !) and the only accepted result is a "plain" data type (no GADTs).morleyDerives, as well as possible, a type definition from its name, its kind (where known) and its variables.)None8 "#$%&'(+-./12356789:<=>?morleyDefault layout in LIGO.To be used with  , see this method for more info.This is similar to , but!fields are sorted alphabetically;always puts as large complete binary subtrees as possible at left.morleyComb layout in LIGO ( [@layout:comb] ).To be used with .Note: to make comb layout work for sum types, make sure that in LIGO all the constructors are preceded by the bar symbol in your type declaration: type my_type = [@layout:comb] | Ctor1 of nat C bar symbol _must_ be here | Ctor2 of int ... !Though the situation may change:  .https://gitlab.com/ligolang/ligo/-/issues/1104.*None8 "#$%&'(+-./12356789:<=>?morley,Leads first character of text to lower case.(For empty text this will throw an error.None8 "#$%&'(+-./12356789:<=>?morley*Constaints that can be provided on demand.Needless to say, this is a pretty unsafe operation. This typeclass makes using it safer in a sense that getting a segfault becomes harder, but still it deceives the type system and should be used only if providing a proper proof would be too difficult.morley%Produce a constraint out of thin air.morley"A value of type parametrized with some type parameter.morleyData.List.Singletons.SList analogue for .morley Similar to SingI [], but does not require individual elements to be also instance of SingI.morleyBring type-level list at term-level using given function to demote its individual elements.morleyMake sure given type is evaluated. This type family fits only for types of ! kind.morley-Fail with given error if the condition holds.morley5Fail with given error if the condition does not hold.morleyDifference between two lists.morley+Remove all occurences of the given element.morleyA natural conclusion from the fact that an error has not occurred.morley*Reify type equality from boolean equality.morleySplit a record into two pieces.morleyGHC can't deduce this itself because in general a type family might be not associative, what brings extra difficulties and redundant constraints, especially if you have complex types. But (++) type family is associative, so let's define this small hack.morleyUtility function to help transform the first argument of a binfunctor.morleyIn majority of the cases we don't want to mock typeclass constraints since coercing instances of typeclasses with methods is utterly unsafe.!,!,None8 "#$%&'(+-./12356789:<=>?morleyWe can have `RequireLongerOrSameLength = (RequireLongerOrSameLength' l a, LongerOrSameLength l a)`, but apparently the printed error message can be caused by  rather than `. We do not know for sure how it all works, but we think that if we require constraint X before Y (using multiple `=>`)s) then X will always be evaluated first.morley; in form of constraint that gives most information to GHC.morley Similar to , but returns !/ when list length equals to the passed number.morley3Comparison of type-level naturals, as a constraint.morley1Comparison of type-level naturals, as a function.It is as lazy on the list argument as possible - there is no need to know the whole list if the natural argument is small enough. This property is important if we want to be able to extract reusable parts of code which are aware only of relevant part of stack.morleyA convenient alias.We are going to use . numbers for type-dependent logic and normal +0s in user API, need to distinguish them somehow.morley;Get the peano singleton for a given type-level nat literal. peanoSing @2 SS (SS SZ)morley Utility to  a Peano !leton.'Useful when dealing with the constraint+*)+*)+None8 "#$%&'(+-./12356789:<=>?morleyPeanoNatural data typeThe PN constructor stores s :: SingNat n and  k :: Natural$ with the following invariant: if PN s k :: PeanoNatural n, then k == n. This definition allows extracting values of Natural without O(n) conversion from  SingNat n.morleyThe following patterns are introduced for convenience. This allow us to avoid writing Succ (Succ Zero) in several places.morley Patterns  and  We introduce pattern synonyms  and  assuming that  and  cover all possible cases that satisfy the invariant. Using these patterns, we also avoid cases when `k /= peanoValSing @n s`morleytoPeanoNatural and toPeanoNatural' connect PeanoNatural with natural numbers known at run-time.  ,None8 "#$%&'(+-./12356789:<=>?morleyFor a given node index i7, this type family checks whether a pair has at least i+1 nodes.Note that the index 0 is always valid, even if the input type is not a pair.morley(Checks whether a pair contains at least n elements.morley3Returns the number of nodes in a right-combed pair.morley4Returns the number of leaves in a right-combed pair. CombedPairLeafCount ('TPair 'TInt ('TPair 'TString 'TUnit)) ~ ToPeano 3If the pair contains sub-trees to the left, they will not be accounted for. E.g. the length of pair w (pair x y) z is 3.None8 "#$%&'(+-./12356789:<=>?morley6Condition Error helper to check if two types are equal:k! AssertTypesEqual Int Int ('Text "This should not result in a failure")AssertTypesEqual Int Int ('Text "This should not result in a failure") :: Constraint= (() :: Constraint, Int ~ Int):k! AssertTypesEqual Bool Int ('Text "This should result in a failure")AssertTypesEqual Bool Int ('Text "This should result in a failure") :: Constraint= ((TypeError ...), Bool ~ Int)morleyConditional type error.*There is a very subtle difference between  and the following type family: type family TypeErrorUnlessAlternative (cond :: Bool) (err :: ErrorMessage) :: Constraint where TypeErrorUnlessAlternative cond err = ( If cond (() :: Constraint) (TypeError err) , cond ~ 'True )If cond? cannot be fully reduced (e.g. it's a stuck type family), then:TypeErrorUnless2 will state that the constraint cannot be deduced.TypeErrorUnlessAlternative( will fail with the given error message err. For example: -- Partial function type family IsZero (n :: Peano) :: Bool where IsZero ('S _) = 'False f1 :: TypeErrorUnless (IsZero n) ('Text "Expected zero") => () f1 = () f2 :: TypeErrorUnlessAlternative (IsZero n) ('Text "Expected zero") => () f2 = () f1res = f1 @'Z -- @ Couldn't match type @IsZero 'Z@ with @'True@ f2res = f2 @'Z -- @ Expected zero%As you can see, the error message in f2res is misleading (because the type argument actually _is_ zero), so it's preferable to fail with the standard GHC error message.   None8 "#$%&'(+-./12356789:<=>?morley)Proxy for a label type that includes the  constraintmorleyUtility function to get the ! representation of a   None8 "#$%&'(+-./12356789:<=>? morley7Isomorphism between named entity and the entity itself.morley Convenience pattern synonym for NamedF Maybe name a, use this instead of  with  ViewPatterns when the name can be inferred.morley1Convenience pattern synonym, use this instead of  with  ViewPatterns when the name" can be inferred. Matches only on Nothing valuesmorley1Convenience pattern synonym, use this instead of  with  ViewPatterns when the name" can be inferred. Matches only on Just valuesmorley1Convenience pattern synonym, use this instead of  with  ViewPatterns when the name can be inferred.morley1Convenience pattern synonym, use this instead of  with  ViewPatterns.morley1Convenience pattern synonym, use this instead of  with  ViewPatterns.morleySpecial version of 'Morley.Util.Named.(:!)' for monadic operationsmorleySpecial version of 'Morley.Util.Named.(:?)' for monadic operations !"$#!" $#44 None8 "#$%&'(+-./12356789:<=>? morleySupporting typeclass for . It specifies how a value should be parsed from command line. Even though the main purpose of this class is to implement helpers below, feel free to use it for other goals.morley"This string will be passed to the ! function, hence we use ! type rather ! (even though we use ! almost everywhere).morleyMaybe add the default value and make sure it will be shown in help message.morley6Parser for path to a file where output will be writen.morley7Parse a number, checking for overflows and other stuff.morley Create a ! for a value using  instance (hence CL in the name). It uses reader and metavar from that class, the rest should be supplied as arguments.We expect some common modifiers to be always provided, a list of extra modifies can be provided as well.morleyA more general version of = which takes a list of extra (not as widely used) modifiers.morleyAkin to (, but for arguments rather than options.morleyAkin to (, but for arguments rather than options.morleyParser for command optionsmorley Create a !' for a value using its type-level name.This expects type-level name to be in camelCase as appropriate for Haskell and transforms the variable inside.%&%&-None8 "#$%&'(+-./12356789:<=>?Bmorley The result of opening the chest.morleyThe chest was opened correctly.morleyThe chest was opened correctly, but the contents do not decode with the given symmetric key.morleyThe chest was not opened correctly, i.e. proof verification failed.morleyA locked chestmorley:A chest "key" with proof that it was indeed opened fairly.morleyCiphertext with nonce.morleyNumber of steps a timelock needs to be opened without knowing a "secret", i.e. modulo factorization.(The reference implementation uses OCaml int, and it can only be positive, so on 64-bit architecture it's actually a 62-bit natural. We use ! to represent it.morleySafely creates  checking for overflow and underflow. Accepts a number of any type.morleyPartial function for  creation, it's pre-condition is that the argument must not exceed bounds of the .morley#Create a timelock puzzle and a key.morleyForge a chest key the hard way.morleyTry to (quickly) open a chest with the given key, verifying the proof.morley Convert a ( to binary representation, used by Tezosmorley Convert a ( to binary representation, used by TezosmorleyRead a * from binary representation, used by TezosmorleyRead a * from binary representation, used by TezosmorleyConstruct a chest purely based on a seed for pseudorandom generator. This is not suitable for cryptography, used in tests.morley Chest contentmorley1Time (in elementary actions) to open without key.morleyPseudo-random seedmorley Chest contentmorley3TLTime (in elementary actions) to open without key. .None8 "#$%&'(+-./12356789:<=>?%q morleyEntrypoint name.'There are two properties we care about: Special treatment of the default entrypoint name. default is prohibited in the CONTRACT instruction and in values of address and contract. types. However, it is not prohibited in the SELF' instruction. Hence, the value inside EpName can be  "default", so that we can distinguish SELF and  SELF %default. It is important to distinguish them because their binary representation that is inserted into blockchain is different. For example, typechecking  SELF %default consumes more gas than SELF. In this module, we provide several smart constructors with different handling of default3, please use the appropriate one for your use case.The set of permitted characters. Intuitively, an entrypoint name should be valid only if it is a valid annotation (because entrypoints are defined using field annotations). However, it is not enforced in Tezos. It is not clear whether this behavior is intended. There is an upstream  +https://gitlab.com/tezos/tezos/-/issues/851issue which received bug label, so probably it is considered a bug. Currently we treat it as a bug and deviate from upstream implementation by probiting entrypoint names that are not valid annotations. If Tezos developers fix it soon, we will be happy. If they don't, we should (maybe temporarily) remove this limitation from our code. There is an  7https://gitlab.com/morley-framework/morley/-/issues/275issue in our repo as well.morleyThis is a bidirectional pattern that can be used for two purposes:  Construct an % referring to the default entrypoint.Use it in pattern-matching or in equality comparison to check whether  refers to the default entrypoint. This is trickier because there are two possible / values referring to the default entrypoints.  will match only the most common one (no entrypoint). However, there is a special case: SELF instruction can have explicit %default7 reference. For this reason, it is recommended to use  instead. Pattern-matching on  is still permitted for backwards compatibility and for the cases when you are sure that  does not come from the SELF instruction.morleyCheck whether given + refers to the default entrypoint. Unlike  pattern, this function correctly handles all cases, including the SELF instruction.morleyMake up / from annotation in parameter type declaration.Returns !# if no entrypoint is assigned here.morleyTurn entrypoint name into annotation for contract parameter declaration.morleyMake up  from annotation which is reference to an entrypoint. Note that it's more common for Michelson to prohibit explicit default entrypoint reference.Specifically, %default' annotation is probitited in values of address and contract$ types. It's also prohibited in the CONTRACT/ instruction. However, there is an exception:  SELF %default is a perfectly valid instruction. Hence, when you construct an $ from an annotation that's part of SELF, you should use  instead.morley Make up an * from an annotation which is part of the SELF instruction.morleyTurn entrypoint name into annotation used as reference to entrypoint.morleyMake a valid entrypoint name from an arbitrary text. This function prohibits explicit default= entrypoint name which is permitted by Michelson inside the SELF instruction. This limitation shouldn't be restrictive because SELF is equivalent to  SELF %default.morleyPartial version of .morleyGiven an untyped parameter type, extract a map that maps entrypoint names to the their parameter types. If there are duplicate entrypoints in the given Type then the duplicate entrypoints at a deeper nesting level will get overwritten with the ones that are on top./None8 "#$%&'(+-./12356789:<=>?+morleyAll kinds of errors that can occur when reading a Michelson value.morleyAn element of an algebraic number field (scalar), used for multiplying  and .morleyG2 point on the curve.morleyG1 point on the curve.morley/Multiplication operations on BLS12-381 objects.morley%Multiply point value by scalar value.morley,Methods common for all BLS12-381 primitives.morleyRepresentation of 0, aka additive identity.morleyNegate a value.morleyAdd up two values.morleyGenerate a random value.morley)Read a value from Michelson's bytes form.Michelson tends to represent all BLS12-381 types in bytes form, some special types also allow other forms.morley)Produce Michelson's bytes representation.morley(Generate a random value from given seed.morleyRead a value from Michelson's bytes form assuming that it is correct.morley Reads an object from hex string.(To be used only in playground and tests.morleyChecks that product of pairings of points in the list is equal to 1 in Fq12 field.morley1; represented in G1 - as the libraries used by Tezos see it.Taken from here:  https://github.com/ethereum/py_ecc/blob/3f644b4c07c8270b8fbe989eb799766aca66face/py_ecc/optimized_bls12_381/optimized_curve.py#L34.morley1 represented in G2.0None8 "#$%&'(+-./12356789:<=>?5o morleyA type error asking to use   instead of !. morleyMichelson string value.This is basically a mere text with limits imposed by the language:  9https://tezos.gitlab.io/whitedoc/michelson.html#constants Although, this document seems to be not fully correct, and thus we applied constraints deduced empirically.You construct an item of this type using one of the following ways:6With QuasyQuotes when need to create a string literal.[mt|Some text|]#UnsafeMText {unMText = "Some text"}With  - when constructing from a runtime text value.With   or   when absolutelly sure that given string does not violate invariants.With   when not sure about text contents and want to make it compliant with Michelson constraints. morley?8] morley"Secp256k1 cryptographic signature. morley#Secp256k1 secret cryptographic key. morley#Secp256k1 public cryptographic key. morley1Deterministicaly generate a secret key from seed. morley&Create a public key from a secret key. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley$Sign a message using the secret key. morleyCheck that a sequence of bytes has been signed with a given key.  2None8 "#$%&'(+-./12356789:<=>?;\ morleyP256 cryptographic signature. morleyP256 secret cryptographic key. morleyP256 public cryptographic key. morley1Deterministicaly generate a secret key from seed. morley&Create a public key from a secret key. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley$Sign a message using the secret key. morleyCheck that a sequence of bytes has been signed with a given key.  3None8 "#$%&'(+-./12356789:<=>?>d morley ED25519 cryptographic signature. morley!ED25519 secret cryptographic key. morley!ED25519 public cryptographic key. morley1Deterministicaly generate a secret key from seed. morley&Create a public key from a secret key. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley Convert a   to raw bytes. morleyMake a   from raw bytes. morley$Sign a message using the secret key. morleyCheck that a sequence of bytes has been signed with a given key.  4None9 "#$%&'(+-./12356789:;<=>?H| morley!Blake2b_160 hash of a public key. morley?V morleyIdentifier of a network (babylonnet, mainnet, test network or other). Evaluated as hash of the genesis block.The only operation supported for this type is packing. Use case: multisig contract, for instance, now includes chain ID into signed data "in order to add extra replay protection between the main chain and the test chain". morleyTime in the real world. Use the functions below to convert it to/from Unix time in seconds. morleyMutez is a wrapper over integer data type. 1 mutez is 1 token (Tz). morleySafely creates   checking for overflow and underflow. Accepts a number of any type. morleyPartial function for   creation, it's pre-condition is that the argument must not exceed bounds of the  . morleySafely create  ."This is recommended way to create Mutez8 from a numeric literal; you can't construct all valid Mutez values using this function but for small values it works neat.4Warnings displayed when trying to construct invalid ! or ! literal are hardcoded for these types in GHC implementation, so we can only exploit these existing rules. morley Addition of   values. Returns ! in case of overflow. morleyPartial addition of  >, should be used only if you're sure there'll be no overflow. morleySubtraction of   values. Returns !7 when the subtrahend is greater than the minuend, and ! otherwise. morleyPartial subtraction of  ?, should be used only if you're sure there'll be no underflow. morleyMultiplication of  " and an integral number. Returns ! in case of overflow. morleyPartial multiplication of   and an Natural number. Should be used only if you're sure there'll be no overflow. morleyEuclidian division of two   values. morleyEuclidian division of   and a number. morley#putTextLn $ prettyTez (toMutez 420) 0.00042 (putTextLn $ prettyTez (toMutez 42000000)42  morley!Add given amount of seconds to a  . morleyDisplay timestamp in human-readable way as used by Michelson. Uses UTC timezone, though maybe we should take it as an argument.?W 7None9 "#$%&'(+-./12356789:;<=>?bM morley:Raw bytes representation of an address has invalid length. morleyRaw bytes representation of an address does not end with "00". morley.Errors that can happen during address parsing. morley%Address is not in Base58Check format. morley,Both address parsers failed with some error. morley(Represents the network's global counter.We store the current value of this counter in the operation at the time of its creation for the following reasons: * to guarantee the uniqueness of contract addresses upon origination (see 'Morley.Michelson.Typed.Operation.mkContractAddress) * to prevent replay attacks by checking that an operation with the same counter value con't be performed twice.The counter is incremented after every operation execution and interpretation of instructions CREATE_CONTRACT and TRANSFER_TOKENS, and thus ensures that these addresses are unique (i.e. origination of identical contracts with identical metadata will result in different addresses.)Our counter is represented as !, while in Tezos it is unbounded. We believe that for our interpreter it should not matter. morley6Data type corresponding to address structure in Tezos. morleytz) address which is a hash of a public key. morleyKT2 address which corresponds to a callable contract. morley.Hash of origination command for some contract. morleyReturns True if given address is implicit. morleySmart constructor for  . morley$Deterministically generate a random   and discard its secret key. morleyCreate a dummy   value by hashing given !.Use in tests **only**. morleyParse an address from its human-readable textual representation used by Tezos (e. g. "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU"). Or fail if it's invalid. morleyParse the given address in its raw byte form used by Tezos (e.g "01521139f84791537d54575df0c74a8084cc68861c00")) . Or fail otherwise if it's invalid. morley-QuasyQuoter for constructing Tezos addresses.3Validity of result will be checked at compile time. morleyParse a KT1 contract address, fail if address does not match the expected format. morleyPartial version of   which assumes that the address is correct. Can be used in tests. morleyPartially parse raw bytes representation of an address and assume that it is correct from the beginning. Can be used in tests. 8None8 "#$%&'(+-./12356789:<=>?eZ morleyUntyped view in a contract. morley View name morleyView argument type morleyView return type morley View code morleyName of the view. #It must not exceed 31 chars length;!Must use [a-zA-Z0-9_.%@] charset. morley0Whether the given character is valid for a view. morley'Maximum allowed name length for a view. morley Construct   performing all the checks. morleyUnsafe constructor for  . morley8Valid view names form a subset of valid Michelson texts.  9None8 "#$%&'(+-./12356789:<=>?kx morley(General untyped contract representation. morleyContract parameter type morleyContract storage type morley%Contract code as a list of operations morleyOriginal order of contract blocks, so that we can print them in the same order they were read morleyContract views morleyConvenience synonym for  representing the storage type morley'Contract block, convenient when parsing morleyTop-level entries order of the contract. This is preserved due to the fact that it affects the output of pretty-printing and serializing contract. morley9The canonical entries order which is ordered as follow:  parameter, storage, and code. morley(Int, Int, Int) is the positions of  parameter, storage, and code respectively. morleyConstruct a contract representation from the contract blocks (i.e. parameters, storage, code blocks, etc.) in arbitrary order. This makes sure that unique blocks like code do not duplicate, and saves the order in the contract so that it can print the contract blocks in the same order it was parsed. TODO [#698]: this is not fully true now. morleyMap each contract fields by the given function and sort the output based on the  . morley3Map all the instructions appearing in the contract.  None8 "#$%&'(+-./12356789:<=>?l^   :None8 "#$%&'(+-./12356789:<=>?p5 morleyByteString does not have an instance for ToJSON and FromJSON, to avoid orphan type class instances, make a new type wrapper around it. morleyA sequence of elements: can be a list, a set or a pair. We can't distinguish lists and sets during parsing. morleyHelper function to render None Value morleyHelper functions to render Values morleyHelper functions to render Values morleyHelper functions to render Values morleyHelper function to render Pair Value morleyHelper function to render Elt morley Converts Pair a (Pair b c) to  [a, b, c]. morley!A helper function that renders a ! list of items in Michelson-readable format, given a rendering function for a single item.  ;None8 "#$%&'(+-./12356789:<=>?umorley.Michelson instruction with abstract parameter op. This parameter is necessary, because at different stages of our pipeline it will be different. Initially it can contain macros and non-flattened instructions, but then it contains only vanilla Michelson instructions.morley"DROP n" instruction. Note: reference implementation permits int16 here. Negative numbers are parsed successfully there, but rejected later. Morley is more permissive, so we use ! here, i. e. permit more positive numbers. We do not permit negative numbers at type level. In practice, probably nobody will ever have numbers greater than D1000 here, at least due to gas limits. Same reasoning applies to other instructions which have a numeric parameter representing number of elements on stack.morley$ is essentially as special case for 8, but we need both because they are packed differently.morley Flatten all  in . This function is mostly for testing. It returns instructions with the same logic, but they are not strictly equivalent, because they are serialized differently (grouping instructions into sequences affects the way they are PACK'ed).<None8 "#$%&'(+-./12356789:<=>?x=None8 "#$%&'(+-./12356789:<=>?zmorleyOperation size in bytes.We use newtype wrapper because there are different units of measure (another one is gas, and we don't want to confuse them).morley9Maximal operation size allowed by Tezos production nodes.morleyBase cost of any transfer of 0 mutez with no extra parameters. (Add valueOpSize 4 to it to get assessment of actual transfer op size)None8 "#$%&'(+-./12356789:<=>?zabcdefghijklomnpqrstuvwxyz{|}~ >None8 "#$%&'(+-./12356789:<=>?morleyType for Micheline ExpressionmorleyMicheline represents both nats and ints using the same decimal format. The Haskell Integer type spans all possible values that the final (Michelson) type could end up being, and then some, so we use (StringEncode Integer) to represent all integral values here for easy JSON encoding compatibility. !?None8 "#$%&'(+-./12356789:<=>?morleyEncode  to !.morleySame as , for strict bytestring.morleyDecode  from !.morleyPartial version of .@None8 "#$%&'(+-./12356789:<=>?emorleyBuilding a record from tuple.%It differs from similar typeclass in Data.Vinyl.FromTuple module in that it allows type inference outside-in - knowing desired ! you know which tuple should be provided - this improves error messages when constructing concrete ! objects.ANone8 "#$%&'(+-./12356789:<=>?!morleyProduce ( instance for tuple of the given length.BNone8 "#$%&'(+-./12356789:<=>?None8 "#$%&'(+-./12356789:<=>?None8 "#$%&'(+-./12356789:<=>?.morleySuppose you have a data type X with parameter a and you have two values:  x1 :: X a1 and  x2 :: X a2 . You can't compare them using !, because they have different types. However, you can compare them using ! as long as both parameters are !.morley Version of  for types with 2 parameters.morley Version of  for types with 3 parameters.morley2Compare two entries of completely different types.morley Extension of  to ! function.morleyCast to a type with phantom type argument without matching this argument. The phantom type must be the last type argument of the type.Example of use: imagine a type data MyType a = MyType Normally, if object of this type was hidden under existential quantification with !/ constraint, then in order to get it back with  you need to know the exact type of the hidden object, including its phantom type parameter. With  you get a way to extract this object no matter which phantom argument it had.morley)Match given type against another type of * -> *. kind without caring about its type argument.    CNone8 "#$%&'(+-./12356789:<=>?k morley>Data type, holding annotation data for a given Michelson type t.;Each constructor corresponds to exactly one constructor of  and holds all type and field annotations that can be attributed to a Michelson type corresponding to t.morleyForget information about annotations, pick singleton with the same type.!Note: currently we cannot derive ! from  without ( because for comparable types notes do not remember which exact comparable was used.morleyGet term-level type of notes.morley In memory of NStar5 constructor. Generates notes with no annotations.morley%Checks if no annotations are present.morleyCombines two annotations trees a and b into a new one c in such a way that c can be obtained from both a and b by replacing some empty leaves with type or/and field annotations.morley?A morley.Errors possible when constructing 'ViewsSet''.morley"Views that belong to one contract.%Invariant: all view names are unique.=Implementation note: lookups still take linear time. We use ! for simplicity, as in either case we need to preserve the order of views (so that decoding/encoding roundtrip).morleyContract view.morleyName of the view.morleyArgument type annotations.morleyReturn type annotations.morley View code.morleyObtain the name of the view.morleyConstruct views set.morley No views.morleyAdd a view to set.morleyFind a view in the set.morley!Get all taken names in views set. " ENone8 "#$%&'(+-./12356789:<=>?morley Similar to , but also gives ! for given type.morley Transparently represent untyped  as wrapper over Notes t from typed world with SingI t constraint.$As expression this carries logic of , and as pattern it performs ! but may make code a bit cleaner.Note about constraints: pattern signatures usually require two constraints - one they require and another one which they provide. In our case we require nothing (thus first constraint is ()#) and provide some knowledge about t.morleyConvert 7 to the isomorphic set of information from typed world.FNone8 "#$%&'(+-./12356789:<=>?morleyDescribes how to construct full contract parameter from given entrypoint argument. This could be just wrapper over Value arg -> Value param, but we cannot use Value type in this module easily.morley