h&+             !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !!!"""##################### $%%%%%%%%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''((((((((((())))))))))))))))))))))))*************************************************************************************+++++,,,,,,,,,,,,,,,,,,,,,,,,--...////////////////////////////////////////////////////////00000000000000001111111111111111111111111112222222222222222333333333334444444444444444444444444444444444444444444444455555666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 6 6 6                                                                                                                                                                                                        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 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 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; < < < < < < < < < < < < < < < < < = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ A A A A A A A A A A A A A A A A A A A A A A A A A A A A AAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHIIIIIIIHHHHHHHHIIIIIIIIIIIIIHHJJJJJJJJJJJJJJJJJJJJJHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQRRRRSSSSSSSSSSSSSSSTTTTTTTTTTTTUUUUUUVVVVVVVVVVVVVWWXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZZZZ[\\\\\\\\\\\\\\\\\\\\\\\\\\]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_____________________________________________________________________________________________________________________```````````````````````````````````````````````````````````````aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdefggggghhhhiiiijjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk                                                                                                    l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m n n n n n n!n!n!n!n!n!n!n!n!n!n!n!n!n!n!n!n!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!o!p!p!p!p!p!p!p!p!p!p!p!p!p!p!p!p!p!p!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!q!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r!r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"r"s"s"s"s"s"s"s"s"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"t"u"u"u"u"u"u"u"u"u"u"u"u"u#u#u#u#u#u#u#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#v#w#w#w#w#w#w#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$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$y$z$z${$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$|$}$}$}$}$}$}$}$}$}$}$}$}$}$}$}$~$~$~$~$~$~$~$~$~$~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%%%%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & & & & & & & & & & & & &&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))********************************************************************************************************************************++++++++++++++++++++++++++++++++++++++++ Safe-Inferred;!#$%&'(),./01245789:;<>?p29morleyBuild 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 +.23456789:;<=>?@A23456789:;<=>?@A Safe-Inferred;!#$%&'(),./01245789:;<>?qMBmorley#Encode a number as tezos does this.>In the Tezos reference implementation this encoding is called zarith.BB Safe-Inferred;!#$%&'(),./01245789:;<>?zCmorleyA new type that can wrap values so that the RenderDoc instances of the combined value can have a different behavior for the pretty printer.EmorleyGeneralize converting a type into a Text.PrettyPrint.Leijen.Text.Doc. Used to pretty print Michelson code and define Fmt.Buildable instances.GmorleyWhether 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).Hmorley/Environment carried during recursive rendering.+morleyWhether the current expression is going to be used as part of top-level expression or in a similar context. When set to +, you may need to wrap your rendered expression into parentheses.ImorleyRenders a list of E elements surrounded with square brackets, separated by a comma and a space.KmorleyConvert + to + with a line width of 80.LmorleyConvert + to + in the same manner as K.MmorleyConvert + to + in the same manner as K.NmorleyGeneric way to render the different op types that get passed to a contract.Omorley0Render a comma-separated list of items in bracesPmorley:Render a semi-colon-separated list of items without bracesQmorleyWrap documents in parentheses if there are two or more in the list.Rmorley#Turn something that is instance of E into a +". It's formatted the same way as K formats docs.Smorley Works as R; above, but doesn't force the doc to be printed in one line+morley9Here using a page width of 80 and a ribbon width of 1.0 https://hackage.haskell.org/package/wl-pprint-1.2.1/docs/Text-PrettyPrint-Leijen.htmlTmorleyConstructors for HUmorleyConstructors for HVmorleyAdd parentheses if needed.Wmorley2Add parentheses if needed, multiline if necessary.XmorleyEnsure parentheses are not required, for case when you cannot sensibly wrap your expression into them.CDEFGHIJKLMNOPQRSTUVWXEFGCDKLMNOPJQRSIHTUVWX Safe-Inferred;!#$%&'(),./01245789:;<>?}t[morleyPath to a leaf (some field or constructor) in generic tree representation.\morleyWhich branch to choose in generic tree representation: left, straight or right. ^ is used when there is one constructor with one field (something newtype-like).The reason why we need ^ 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 ^, in both cases path will be the same ([L]).[\]_^\]_^[ Safe-Inferred;!#$%&'(),./01245789:;<>?`morleyCompute a cryptographic hash of a bytestring using the Blake2b_256 cryptographic hash function. It's used by the BLAKE2B instruction in Michelson.amorleyCompute a cryptographic hash of a bytestring using the Blake2b_160 cryptographic hash function.bmorleyCompute a cryptographic hash of a bytestring using the Sha256 cryptographic hash function.cmorleyCompute a cryptographic hash of a bytestring using the Sha512 cryptographic hash function.dmorleyCompute a cryptographic hash of a bytestring using the Sha3_256 cryptographic hash function. It is used by the SHA3 Michelson instruction.emorleyCompute a cryptographic hash of a bytestring using the Keccak_256 cryptographic hash function. It is used by the KECCAK Michelson instruction.`abcde`aebdc Safe-Inferred;!#$%&'(),./01245789:;<>?fmorleyOptions that we use in morley-based packages (including morley ) by default.ff Safe-Inferred<!#$%&'(),./01245789:;<=>?~&gmorley+Datatype representing arbitrary annotation.kmorley*Field annotation for the entire parameter.lmorley#A convenience synonym for variable |mmorley A convenience synonym for field |nmorleyA convenience synonym for type |omorley'Type-level tag for variable annotationspmorley$Type-level tag for field annotationsqmorley#Type-level tag for type annotationsrmorleyA constraint representing that type-level annotation tag is known at compile-timesmorleyWhat prefix is used for the given annotation type (identified by tag) in Michelson code, i.e. % for field annotations, @ for variable annotations, : for type annotationstmorleyAn t contains all the typefield variable |s , 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 |s 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 |', they are omitted - if one or more  precede a non-empty |%, they are kept - every non-empty | is obviously kept This is why order for each group is important as well as separation of different groups of |s.ymorley&Either one or two variable annotations|morley 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.%@]*morley8Unidirectional pattern synonym used to pattern-match on | without invoking }morleyAn t without any |.morleyAn t with only a single | (of any kind).morleyAn t with several |s of the same kind.morleyAn t built from all 3 kinds of |.morleyReturns + if all |s in the Set are unnecessaryempty. False otherwise.morleyReturns the amount of |;s that are necessary for a consistent representation. See t.morleyRemoves all unnecessary |s. See t.+morleyRemoves all unnecessary |s from a list of the same typemorley%Returns the number of annotations in t for each type.morleyReturns the first annotation in a list of annotations of a specific type in t, or  if this list is empty.morleyReturns the second annotation in a list of annotations of a specific type in t, or , if this list contains less than 2 elements.+morley0Retrieves an annotation of a specific type from t using the passed function.+morleyRenders a single |, this is used in every rendering instance of it. Note that this also renders empty ones/s because a single | does not have enough context to know if it can be omitted, use ! if you want to hide it instead.+morleyRenders a list of |#s, omitting unnecessary empty ones/'. This is used (3 times) to render an t.morleyEmpty |, i.e. no annotationmorley Makes an |" from its textual value, prefix (%@:) excluded Returns a + error message if the given + contains invalid charactersmorley :t [annQ||],... :: forall {k} {tag :: k}. Annotation tag:t [annQ|abc|],... :: forall {k} {tag :: k}. Annotation tagmorley:t [typeAnnQ||]... :: TypeAnn:t [typeAnnQ|abc|]... :: TypeAnnmorley:t [fieldAnnQ||]... :: FieldAnn:t [fieldAnnQ|abc|]... :: FieldAnnmorley:t [varAnnQ||] ... :: VarAnn: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 .ghijklmnopqrstuvwxyz{|}~.|}~yz{tuvwxrsnmlkqpoghij Safe-Inferred;!#$%&'(),./01245789:;<>?~   Safe-Inferred;!#$%&'(),./01245789:;<>?morleyIsomorphism between  Bimap a b and  Bimap b a.morley Left-biased +& instance. It assumes the left value a is the key (just like the  At (Map k v) instance).!To flip this assumption, use the  optic.morley Left-biased +& instance. It assumes the left value a is the key (just like the  Ix (Map k v) instance).!To flip this assumption, use the  optic. Safe-Inferred;!#$%&'(),./01245789:;<>?M morleyDescribes how  should decode tag-dependent data. We expect bytes of such structure: 5 followed by a bytestring which will be parsed with .morleySpecialization of  to + transformer.morleyAny decoding error.morley Alias for  constructor specialized to +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.morleyCommon decoder for the case when packed data starts with a tag (1 byte) that specifies how to decode remaining data.This is a version of  specialized to naked + monad.morleyCommon decoder for the case when packed data starts with a tag (1 byte) that specifies how to decode remaining data.This is a general version of  that allows +' to be wrapped in a monad transformer.00 Safe-Inferred;!#$%&'(),./01245789:;<>?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. Safe-Inferred;!#$%&'(),./01245789:;<>?morleyNewtype wrapper for ByteString which uses hexadecimal representation for JSON serialization. Safe-Inferred<!#$%&'(),./01245789:;<=>?morleyAlways truthful unary constraint. Can be used to essentially turn  into a somewhat inefficient Some.morleyMap over argument.morleyTraverse over argument.morley#Apply function to constrained valuemorleyMonadic morleyFlipped version of morleyFlipped version of     Safe-Inferred;!#$%&'(),./01245789:;<>?x  Safe-Inferred;!#$%&'(),./01245789:;<>?morleyIf monadic action returns a + value, it will be thrown. Otherwise the returned value will be returned as is.  Safe-Inferred;!#$%&'(),./01245789:;<>?morley Similar to , but compares types via  DefaultEq& used in singletons comparisons (see Data.Eq.Singletons module).! Safe-Inferred;!#$%&'(),./01245789:;<>?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." Safe-Inferred;!#$%&'(),./01245789:;<>?h# Safe-Inferred;!#$%&'(),./01245789:;<>?morleyA + of morleyDatatype encoding transformations we apply to a quoter input and output. Note the order is important! We first unescape, then unindent, then trim.morleyUsed to generate quasi-quotersmorley Generate TH +/ for a quoter based on a set of transformationsmorleyMake a +$ using a given set of transformaionsmorley A version of  Fmt.indentF' that doesn't indent the first line, and keeps the final line break intact.  Safe-Inferred;!#$%&'(),./01245789:;<>?morley?For datatype with "myNyan" field it will create "myNyanL" lens.$ Safe-Inferred;!#$%&'(),./01245789:;<>?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.% Safe-Inferred;!#$%&'(),./01245789:;<>?morleyA helper record datatype representing a mismatch between two values of some type. One is assumed to be in some sense the "expected" value, the other one is assumed to be the "actual" value.morleyExpected valuemorley Actual valuemorley$Render a mismatch error with a diff.1This is intended to be used with types for which E outputs multiline +'. Generally those are types wrapped in C.morley-Render a mismatch error of lists with a diff.1This is intended to be used with types for which E outputs multiline +'. Generally those are types wrapped in C.& Safe-Inferred<!#$%&'(),./01245789:;<=>?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 key+morleyPredicate checking if type is unitmorleyPredicate checking if type is  signature+morleyPredicate checking if type is  operationmorley8Predicate 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>>' Safe-Inferred;!#$%&'(),./01245789:;<>?q morleyAn inline test assertionmorley!A comment with optional embedded  s. Used with PRINT extended instruction.morleyA 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-patternmorley8Copy 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( Safe-Inferred;!#$%&'(),./01245789:;<>?ʵmorleyA second-order analogue of ,'. This serves the same purpose as the Data.Singletons. class. However, the  singletons version requires a separate instance for each type in order to support GHC versions that don't offer QuantifiedConstraints+. We only need one instance for all types.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.morleyHelper function to generate , and  instances using Sing" as prefix for the type names and S for constructors'.morley"Singleton-based implementation of geq  ) Safe-Inferred;!#$%&'(),./01245789:;<>?morleyAddress "kind"morleyan implicit address, tz1-tz3morleya contract address, KT1morleya smart rollup address, sr1  * Safe-Inferred;!#$%&'(),./01245789:;<>?ѐmorley&A product type of all classifications.morley5Whether an instruction carries Michelson annotations.morleyStandard means that the first constructor argument contains all annotations as Anns type, which is true for most annotated instructions. There are a couple exceptions, however.morley9There is corresponding instruction in the Michelson spec.morley"Extended instructions". Don't affect execution on chain, but may affect execution on the morley emulator.morley%Wrappers that don't affect execution.morleyMichelson structures that are not instructions, e.g. a nested code block.morleyWhether an instruction always fails. An example of always-failing instruction is NEVER.morleyInstruction always fails.morleyInstruction might fail if inputs are incorrect, but will generally work.morleyNumber of children instructions a given instruction constructor has.morleyIt is unknown at compile-time whether the instruction has children or not.morley3The instruction has children indirectly, as values.morley The instruction has no children.morleyThe instruction has one child.morley!The instruction has two children.+ Safe-Inferred;!#$%&'(),./01245789:;<>?պmorley Generates an + instance for a GADT.On superclass constraints for type arguments: we use heuristics to guess for which type arguments we need to add NFData instance. If this behaves not as you want, probably it's just worth starting passing the necessary constraints to this function manually.morleyCheck if name is a typemorleyAccepts a type constructor and fills it with variables until getting a type of kind *.morleyGiven a list of types, produce the type of a tuple of those types. This is analogous to + and +. tupT [[t|Int|], [t|Char|], [t|Bool]] = [t| (Int, Char, Bool) |] , Safe-Inferred;!#$%&'(),./01245789:;<>?.+morley0Reorders entries corresponding to constructors (a) and fields (b) according to some rule.+morleySimple type synonym used (internally) between functions, basically extending + with the +s of the constructor and its fields. For fields it carries both names in the original order and in the order specified by the strategy (and the latter is paired with depths).+morleyConstructor's depth+morleyConstructor's name+morley2Names of constructor fields in the original order.+morleys for it. This function should when possible make checks and +, using the constructors' + provided by the +.+morley'Reorder constructors given their names.+morleyReorder fields given their names, the argument depends on whether fields are part of record (and thus named) or not (unnamed).+morleySimple tuple that carries basic info about a constructor: it's name, number of its fields and their names. Used only in this module.+morleySimple tuple that defines the "shape" of a constructor: it's name and number of fields. Used only in this module.+morleySimple tuple specifying the depth of a constuctor and a list of depths for its fields.This is used as a way to specify the tree topology of the Generic instance to derive.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.+morleyConstruct a strategy that only constructs Generic instance of given form, without e.g. changing the order of entries.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)morleyLike , but allows specifying different strategies for constructors and fields.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.+morleyApply a reordering strategy.This uses given  [CstrNames] to understand how constructors and their fields should be reordered, and applies the same transposition to entries within +.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.+morley4Extract the info for each of the given constructors.+morley#Combines depths with constructors, +*ing in case of mismatches, and generates +"s for the constructors' arguments.+morley Creates the + type for an unbalanced + instance, for a type given its name, constructors' depths and derived full type.Note: given that these types definition can be very complex to generate, especially in the metadata, here we let generic-deriving# make a balanced value first (see +!) and then de-balance the result.+morleyBreaks down a tree of Generic types from the contructor of "nodes" and the constructor for "leaves" metadata.This expects (and should always be the case) the "root" to be a Generic metadata contructor, which is returned in the result alongside the list of leaves (in order).+morleyCreate the unbalanced + fuction declaration for a type starting from its list of weighted constructors.+morleyCreate the unbalanced + fuction declaration for a type starting from its list of weighted constructors.+morleyRecursively aggregates the values in the given list by merging (with the given function) the ones that are adjacent and with the same depth.This will fail for every case in which the list cannot be folded into a single 0-depth value.+morley(Original name of a constructor or field.morleyPatch a given strategy by applying a transformation function to constructor names before passing them through ordering function.morleyPatch a given strategy by applying a transformation function to field names before passing them through ordering function.- Safe-Inferred;!#$%&'(),./01245789:;<>?*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. Safe-Inferred;!#$%&'(),./01245789:;<>?Mmorley,Leads first character of text to lower case.(For empty text this will throw an error.morley)Drops the field name prefix from a field.We assume a convention of the prefix always being non-uppercase, and the first letter of the actual field name being uppercase.morleyTransform text to  camelCase.If the text starts with a single uppercase letter, it is lowercased. If it starts with a cluster of non-lowercase letters, all but the last in the cluster are lowercased.toCamel "MyField" "myField"toCamel "USPosition" "usPosition"toCamel "FA2Config" "fa2Config"morleyTransform text to  snake_case.Non-lowercase clusters starting with an uppercase letter are treated as separate words, except the last letter in the cluster.toSnake "MyField" "my_field"toSnake "USPosition" "us_position"toSnake "FA2Config" "fa2_config"toSnake "MyUSPosition""my_us_position"toSnake "MyFie123d" "my_fie123d"morleyTransform text to  spinal-case.Non-lowercase clusters starting with an uppercase letter are treated as separate words, except the last letter in the cluster.toSpinal "MyField" "my-field"toSpinal "USPosition" "us-position"toSpinal "FA2Config" "fa2-config"toSpinal "MyUSPosition""my-us-position"toSpinal "MyFie123d" "my-fie123d"morleyIf text starts with a cluster of non-lowercase letters, lowercase them except the last one.lowerCaseCluster "USPosition" "usPosition"lowerCaseCluster "Position" "Position"lowerCaseCluster "FA2Config" "fa2Config"morley>Cut fields prefixes which we use according to the style guide.stripFieldPrefix "cmMyField" "myField" - - Safe-Inferred;!#$%&'(),./01245789:;<>?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.morleyFail with given error if the condition does not hold. Otherwise, return the third argument.morley A version of - that imposes an equality constraint on its + argument.morleyFail with given error if the condition does not hold. Otherwise, return the third argument.%There is a subtle difference between FailWhenElsePoly# and the following type definition::{/type FailWhenElsePolyAlternative cond msg els = If cond (DelayError msg) els:}If cond cannot be fully reduced (e.g., it's a stuck type family application or an ambiguous type) then:FailWhenElsePoly will state that the constraint cannot be deduced (and this error message will be suppressed if there are also custom type errors).FailWhenElsePolyAlternative) will fail with the given error message, err. For example::{-- Partial function-type family IsZero (n :: Peano) :: Bool where IsZero ('S _) = 'False--f1 :: ( IsZero n ~ 'True , FailWhenElsePoly (IsZero n) ('Text "Expected zero") (() :: Constraint)) => ()f1 = ()--f2 :: ( IsZero n ~ 'True , FailWhenElsePolyAlternative (IsZero n) ('Text "Expected zero") (() :: Constraint)) => ()f2 = ():}f1 @'Z...2... @ Couldn't match type @IsZero 'Z@ with @'True@...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.morley A version of - that imposes an equality constraint on its + argument.morleyConstrain two types to be equal, and produce an error message if they are found not to be.:k! FailUnlessEqual Int Int ('Text "This should not result in a failure")FailUnlessEqual Int Int ('Text "This should not result in a failure") :: Constraint= (() :: Constraint, Int ~ Int):k! FailUnlessEqual Bool Int ('Text "This should result in a failure")FailUnlessEqual Bool Int ('Text "This should result in a failure") :: Constraint= ((TypeError ...), Bool ~ Int)morleyConstrain two types to be equal. If they are found not to be, produce an error message. If they are shown to be equal, impose an additional given constraint.:k! FailUnlessEqualElse Int Int ('Text "This should not result in a failure") ()FailUnlessEqualElse Int Int ('Text "This should not result in a failure") () :: Constraint= (() :: Constraint, Int ~ Int):k! FailUnlessEqualElse Bool Int ('Text "This should result in a failure") ()FailUnlessEqualElse Bool Int ('Text "This should result in a failure") () :: Constraint= ((TypeError ...), Bool ~ Int)the ~ constraint might seem redundant, but, without it, GHC would reject:{=foo :: FailUnlessEqualElse a b ('Text "MyError") () => a -> bfoo = id:}%GHC needs to "see" the type equality ~ in order to actually "learn" something from a type family's result.We use + here, rather than , so this will work with type variables known to be equal, even if nothing is known about them concretely. For example, the following will compile::{=foo :: FailUnlessEqualElse a b ('Text "MyError") () => a -> b foo x = x-- bar :: a -> a bar = foo:} If we used (==), then bar would be rejected.(==)- has its place (see the comments below it in Data.Type.Equality) but I don't think it has anything to offer us here. In particular, the equality constraint we bundle up seems to win us all the reasoning power that (==) would provide and more. The following adaptation of the example in the Data.Type.Equality comments compiles::{>foo :: FailUnlessEqualElse (Maybe a) (Maybe b) ('Text "yo") ()3 :- FailUnlessEqualElse a b ('Text "heya") ()foo = Sub Dict:}In this example, the entire consequent follows from the equality constraint in the antecedent; the  part of it is irrelevant, so we don't need to be able to reason from it. If we were reasoning solely using (==), foo< would be rejected because the error messages are different.morleyDifference between two lists.morley+Remove all occurences of the given element.morleyAppend for type-level lists. We use this synonym instead of using the one from Data.Vinyl.TypeLevel directly because the latter is missing a fixity declaration. See the  .https://github.com/VinylRecords/Vinyl/pull/165vinyl pull request.morley+Equality constraint in form of a typeclass.morleyA natural conclusion from the fact that an error has not occurred.morley Given a type-level list that is ,(, construct evidence that it is also a  . Note that 8 is weaker, hence this construction is always possible.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.''5. Safe-Inferred;!#$%&'(),./01245789:;<>?+morley;A class to constrain unsafe operations to a stubbed proof. + is uninhabited, making it impossible to define an instance of this class.morley Assume a  KnownList by providing a fake . Can only be done inside a + proof. This is not entirely safe due to the existence of things like Any9, and with enough effort one could theoretically get an + out of a proof that uses this, but arguably it's "safe enough".morleyAssume SingI by providing a fake +. Can only be done inside a +# proof. Same caveats apply as with .morley&Ignore the first argument and instead + the result. It is assumed that the first argument constitutes a semi-proper proof. Safe-Inferred<!#$%&'(),./01245789:;<=>?.cmorleyA convenient alias.We are going to use . numbers for type-dependent logic and normal +0s in user API, need to distinguish them somehow.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 produces good error message. Should be used together with  because  gives GHC more information. We use it in combination, so that it gives enough information to GHC and also producess good error messages.+morleyComparison of type-level naturals, raises human-readable compile error when does not hold.%Here we use the same approach as for  , this type family is internal.+morleyEvaluates list length.This type family is a best-effort attempt to display neat error messages when list is known only partially.For instance, when called on Int ': Int ': s, the result will be OfLengthWithTail 2 s! - compare with result of simple  - 1 + 1 + Length s.5For concrete types this will be identical to calling FromPeano (Length l).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 "lazier" version of .  LazyTake n xs( will always produce a list of exactly n elements. If xs has less than n elements, then some of the elements of the result will be stuck. Similarly, if some tail of xs is stuck or ambiguous, then elements of the result past that point will be stuck.  LazyTake ( 4) '[1,2,3,4,5] ~ '[1,2,3,4] LazyTake (ToPeano 4) (1 ': 2 ': 3 ': 4 ': Any) ~ '[1,2,3,4] LazyTake (ToPeano 4) '[1,2] ~ '[1, 2, Head '[], Head (Tail '[])] LazyTake is often better than Take? for driving type inference. For example, given the constraint 5xs ~ Take (ToPeano 3) xs ++ q ': Drop (ToPeano 4) xs ,GHC can't infer anything about the shape of xs. However, the constraint 9xs ~ LazyTake (ToPeano 3) xs ++ q ': Drop (ToPeano 4) xs will allow GHC to infer 0xs ~ x1 ': x2 ': x3 ': q ': Drop (ToPeano 4) xs morleyA type-level version of ". Note that in many cases, using % instead will improve type inference.morley Out of two  naturals, return the larger onemorley Out of two ! naturals, return the smaller onemorley naturals subtractionmorley naturals additionmorley naturals comparissonmorley naturals comparissonmorleyA synonym for SingI (ToPeano n)/. Essentially requires that we can construct a  singleton for a given +morley"A constraint asserting that GHC's Nat n and Peano p% are the same (up to an isomorphism)morley;Get the peano singleton for a given type-level nat literal. peanoSing @2 SS (SS SZ)morleySame as , but only requires + instance.'Witnesses half the equivalence between  KnownNat n and SingI (ToPeano n)morleyRun a computation requiring SingI (ToPeano n) in a context which only has  KnownNat n. Mostly useful when used with +morleyLift a given term-level + to the type level for a given computation. The computation is expected to accept a + for the sake of convenience: it's easier to get at the type-level natural with ScopedTypeVariables) when pattern-matching on the proxy, e.g. (x :: Natural) `withSomePeano` \(_ :: Proxy n) -> doSomeNatComputation @nmorley Utility to  a Peano +leton.'Useful when dealing with the constraintmorleySingleton additionmorleyConvenience synonym for +morleyProof that for naturals, k + (m + 1) = n entails n > kmorleyProof that for naturals, x + (y + 1) = (x + y) + 1morley Proof that  x + y = y + xmorleyProof that for naturals,  min(n, n) = nmorleyProof that for naturals,  x >= y > z implies x > z0./01001./1/ Safe-Inferred;!#$%&'(),./01245789:;<>?EF!morleyExistential capturing a fixed-size list whose length is only known at runtime.In most cases, it's probably better to use regular lists, but this can be occasionally useful.We do not provide the + and , instances, since "zipper" applicative is ill-defined for lists of different length, and having inconsistent instances between this and  is more confusing than useful.Unlike regular sized list,  SomeSizedList is a , and a ,:>fromList "ab" <> fromList "de" <> mempty :: SomeSizedList CharSomeSizedList (SS (SS (SS (SS SZ)))) ('a' :< 'b' :< 'd' :< 'e' :< Nil)morley-Actual fixed-size list GADT, parametrized by  natural. You generally don't want to use this directly, since % is not very ergonomic. Prefer using  unless writing utility functions that need to do type-level arithmetic..Note that while this has the usual instances, + and , are not the same as for regular lists: they implement "zipper" semantics, i.e. f <*> x is the same as zipWith ($) f xmorley?The primary fixed-size list type. Parametrized by a type-level ,% as length and type as element type.Internally powered by  numbersmorleySized list Nil pattern. Unlike  this pattern can be used to auto-deduce the type of the result, see .morley Sized list cons pattern. Unlike  this pattern can be used to auto-deduce the type of the result, e.g.!a ::< b ::< c ::< Nil' = pure 'a' (a, b, c) ('a','a','a')morley;Try to make a fixed-size list from a regular list, given a , . Returns ,+ if the regular list has incorrect length.fromListMaybe @3 [1, 2, 3]Just (1 :< 2 :< 3 :< Nil)fromListMaybe @4 [1, 2, 3]NothingmorleySame as , but accepts an explicit  singleton.morleyRun some computation with a , list converted to ". Similar to pattern-matching on , but asserts on the type level that list is in fact not empty.morley.Run some computation with a list converted to #. The same as pattern-matching on .morleyConstruct a list of given length from a regular list. Raise error if length is inconsistent.unsafeFromList @3 [1, 2, 3]1 :< 2 :< 3 :< NilunsafeFromList @1 [1, 2, 3]*** Exception: Invalid list size in Morley.Util.SizedList.unsafeFromList...,morleySame as , but accepts explicit  singletonmorley Convert a  to ,morleyReplicate a value n times. This is a version returning an existential. You probably want  or `.morleyReplicate a value n times, where n is passed as a type-level natural. This is essentially a synonym for ,.replicateT @5 'a'&'a' :< 'a' :< 'a' :< 'a' :< 'a' :< NilmorleyAs , but accepts an explicit  singleton.morleyZip two lists of potentially different lengths. If one list is longer, extraneous elements will be ignored.8zip (unsafeFromList @3 "abc") (unsafeFromList @4 "defg")*('a','d') :< ('b','e') :< ('c','f') :< NilmorleyZip using a binary operation.morleyGiven a type-level ," and a generator function, make a Indexing starts at 0generate @3 (+1)1 :< 2 :< 3 :< NilmorleySame as , but accepts an explicit  singleton, and passes an explicit singleton as index to the generator functionmorley Reverse a reverse $ generate @3 (+1)3 :< 2 :< 1 :< NilmorleyAppend two sized lists.+generate @3 (+1) `append` generate @3 (+11)$1 :< 2 :< 3 :< 11 :< 12 :< 13 :< Nilmorley#Unzip a sized list using a functionmorleyUnzip a sized list of pairsmorley-Index into a list using a type-level constant#index @2 $ unsafeFromList @5 [1..5]3morleySame as , but accepts an explicit  singleton(Note, that if you wish to use this with `, indexing into some other list, for one, you may want to rethink your approach, since it's pretty inefficient. For two, you may run into arcane compiler error messages, e.g.'let someList = 'a' :< 'b' :< 'c' :< Nilgenerate' @_ @Char (peanoSing @2) $ \(sg, _) -> index' sg someList...5 @ Could not deduce: ('S ('S ('S 'Z)) > m) ~ 'True...To make this work, use  proof:let slLen = length' someListlet len = peanoSing @2generate' @_ @Char len $ \(sg, _) -> index' sg someList \\ transitivity slLen len sg'a' :< 'b' :< NilmorleyUse a term-level + to index into a list. Since the natural can be larger than the length of the list, returns a ,.morley)Get the first element of a non-empty listmorleyGet elements after the firstmorleyConstruct a list of one elementmorley7Take a fixed number of elements, given by a type-level ,,. Must be smaller than the size of the list"take @3 $ unsafeFromList @5 [1..5]1 :< 2 :< 3 :< Nilmorley7Drop a fixed number of elements, given by a type-level ,,. Must be smaller than the size of the list"drop @3 $ unsafeFromList @5 [1..5] 4 :< 5 :< Nilmorley(splitAt @n xs = (take @n xs, drop @n xs)#, but traverses the list only once%splitAt @3 $ unsafeFromList @5 [1..5]"(1 :< 2 :< 3 :< Nil,4 :< 5 :< Nil)morley5Return a Peano singleton representing the list lengthmorley Empty listmorleyCons&(555 Safe-Inferred;!#$%&'(),./01245789:;<>?Fr  0 Safe-Inferred;!#$%&'(),./01245789:;<>?G1 Safe-Inferred;!#$%&'(),./01245789:;<>?Kmorley"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.2 Safe-Inferred;!#$%&'(),./01245789:;<>?PmorleyPeanoNatural 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.morley Check if two s are equal, and return evidence of type equality between the corresponding ,s.morleyGet a corresponding  from a . 3 Safe-Inferred;!#$%&'(),./01245789:;<>?V ,morleyClass implementing , over a stack of ,.morley,%, only it maps over the whole nested , stack, and not just one level.,morley#Typeclass implementing versions of , and ,5 that aren't constrained by a functional dependency.morleyUnconstrained version of ,?. Lifts the appropriate number of times depending on the type r.morleyUnconstrained version of ,>. Maps the appropriate number of times depending on the type r.,morley$Given a transformer stack of nested ,, get a list of environments. This type family is essentially a witness of isomorphism between a stack of ,. and a type-level list of reader environments.This is useful because & can't have an injectivity annotation.,morleyFind the index of the first occurrence of the first argument in the second argument as a Peano number.$Essentially a type-level version of ,.0Raises a type error if the element is not found.morley$Replace the base monad for a nested , stack.morleyConvenience constraint synonym. Required for ,`, ,`, ,` and morley5Convenience type family to build a stack of multiple ,.morleyUnconstrained version of ,. asks' f = fmap f ask'.4 Safe-Inferred;!#$%&'(),./01245789:;<>?Wmorley6Michelson language type with annotations stripped off.morleyConverts from  to .morley"Format type stack in a pretty way.##5 Safe-Inferred;!#$%&'(),./01245789:;<>?[&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.6 Safe-Inferred;!#$%&'(),./01245789:;<>?^,morley, and  instances for the  kind.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 .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 +%% Safe-Inferred;!#$%&'(),./01245789:;<>? morley.Error type for when a value is not well-typed. morleyThis class encodes Michelson rules w.r.t where it requires comparable types. Earlier we had a dedicated type for representing comparable types CT,. But then we integreated those types into T. This meant that some of the types that could be formed with various combinations of T would be illegal as per Michelson typing rule. Using this class, we inductively enforce that a type and all types it contains are well typed as per Michelson's rules. morley2Constraints required for instance of a given type. morley2Constraints required for instance of a given type. morleyAllows 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. morleyAlias for comparable types. 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 it morley=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 it morley;Set of constraints that Michelson applies to packed values.?Not just a type alias in order to be able to partially apply it morley$Returns whether the type is dupable. morley2Alias 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 it morley>Set of constraints that Michelson applies to contract storage.?Not just a type alias in order to be able to partially apply it morley8Set of constraints that Michelson applies to parameters.?Not just a type alias in order to be able to partially apply it,morley-Whether a value of this type _may_ contain a  sapling_state value.,morleyA value of type t may or may not contain a  sapling_state value.,morleyA value of type t cannot contain  sapling_state values. morley2Whether 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 compared morley This is like  ., it raises a more human-readable error when t; type is concrete, and also imposes an equality constraint. Use this constraint in our eDSL. morley:Constraint which ensures that there are no nested bigmaps.,morley.Constraint which ensures that a value of type t does not contain  sapling_state values. 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.,morley-Whether a value of this type _may_ contain a  samping_state value. 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. 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 whether a value of the given type _may_ contain a  sapling_state value. 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.,morley?Check at runtime that a value of the given type cannot contain ticket values. morleyCheck at runtime that a value of the given type cannot containt big_map values,morleyCheck at runtime that a value of the given type cannot containt  sapling_state values morleyCheck at runtime that a value of the given type cannot contain nested big_maps.,morleyProduce evidence that the first argument of a disjunction is false if the whole disjunction is false.,morleyWhen a class looks like class (SomeTypeFamily t ~ 'False, ...) => TheClass t instance (SomeTypeFamily t ~ 'False, ...) => TheClass t and the additional constraints are satisfied by the instance constraints of the   instance for TheClass, we can use , to define   for the instance. morleyGiven a type, provide evidence that it is well typed w.r.t to the Michelson rules regarding where comparable types are required. morley Version of   that accepts + at term-level. morleyInductive proof that   implies  . This is stubbed with an unsafeCoerce Refl( at runtime to avoid runtime traversals. morleyInductive proof that   implies  . This is stubbed with an unsafeCoerce Refl( at runtime to avoid runtime traversals.,+  ,+7 Safe-Inferred;!#$%&'(),./01245789:;<>?p ,morleyCheck that Generic representation for a constructor has given field  fieldName.,morleyCheck that Generic + has given field  fieldName in a given constructor conName.,morley#Actual recursive implementation of ,.,morley9Check whether all fields described for given constructor conName are present in the datatype.This family also checks whether the constructor is present and fails with a  TypeError otherwise.,morley%Check whether given constructor name conName is present in + of a datatype.,morley$Actual recursive implementation for  . morleyThis 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  TypeError if there none. morleyValue-level counterpart to  . morley8Description 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") ]) ) ]   Safe-Inferred;!#$%&'(),./01245789:;<>?    Safe-Inferred;!#$%&'(),./01245789:;<>?! morley)Proxy for a label type that includes the  constraint morleyUtility function to get the + representation of a      Safe-Inferred;!#$%&'(),./01245789:;<>?6 morley7Isomorphism between named entity and the entity itself. morleyConvenience pattern synonym. Use to construct an optional named value.1To pattern-match on an optional named value, use  or   in a view pattern::{let someFunc (argDef #arg1 "" ->arg1) (argDef #arg2 "" -> arg2) = arg1 <> arg2'in someFunc ! #arg1 "asd" ! #arg2 "efg":}"asdefg" morley arg1) (arg #arg2 -> arg2) = arg1 + arg2in someFunc ! #arg1 1 ! #arg2 2:}3 morleySpecial version of 'Morley.Util.Named.(:!)' for monadic operations morleySpecial version of 'Morley.Util.Named.(:?)' for monadic operations,morleyIsomorphism between named entity and the entity itself wrapped into the respective functor. !"% #$&'( "&' % #$ #(!  4 4 Safe-Inferred;!#$%&'(),./01245789:;<>?_ 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 options morley 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.)*  )* 8 Safe-Inferred;!#$%&'(),./01245789:;<>? morley 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 chest morley:A chest "key" with proof that it was indeed opened fairly. morleyCiphertext with nonce.,morley!A nonce for symmetric encryption. 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.The constructor is marked Unsafe since GHC does not warn on overflowing literals (exceeding custom ,# type bounds), thus the resultant  " value may get truncated silently. UnsafeTLTime 4611686018427387906UnsafeTLTime {unTLTime = 2},morleyA "proof" that the chest was opened fairly, i.e. the key wasn't just guessed.&The proof is verified by checking that) a ^ (2 ^ t) = (p ^ l) (a ^ r) \pmod n which is equivalent to 2 ^ t = (((2 ^ t) / l) * l) + (2 ^ t \mod l) \pmod {\phi(n)} where a is a , value, t is  , p is ,, n is ,, l is a prime, chosen deterministically from the hash of the puzzle, and r = 2^t \pmod lWhat this essentially boils down to, is that we can compute the "proof" either as* p = a^{2^t / l \mod {\phi(n)}} \pmod n 'if we know the modulo factorization, or p = a^{2^t / l} \pmod n  if we don't.See  $https://eprint.iacr.org/2018/712.pdf section 3.2.,morley&The key for the symmetric encryption, K.,morleyThe "unlocked" value, i.e. a^{2^t} \pmod n, where a is , value, t is   and n is ,.,morleyThe "locked" value. Essentially a random integer between 0 and , (exclusive).,morley RSA-inspired semi-prime modulus.,morley:RSA-inspired prime factors, which produce (literally) the ,.!This value should be kept secret. morleySafely creates   checking for overflow and underflow. Accepts a number of any type. morleySafely creates  .&This is the recommended way to create   values.When constructing literals, you'll need to specify the type of the literal. Bear in mind that GHC will check for literal overflow on builtin types like , and , , but not on ,, so be aware that   from , will overflow silently. Prefer using builtin types when possible.3unTLTime $ toTLTime (4611686018427387903 :: Word62)46116860184273879033unTLTime $ toTLTime (4611686018427387904 :: Word62)0 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 Tezos morley Convert a  ( to binary representation, used by Tezos morleyRead a  * from binary representation, used by Tezos morleyRead a  * from binary representation, used by Tezos morleyConstruct 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. 9 Safe-Inferred;!#$%&'(),./01245789:;<>? 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. morleyA simple enum flag to choose how to handle implicit default entrypoint in  . morley=Omit the default entrypoint unless it's specified explicitly. morleyInclude the default entrypoint even if it's not specified explicitly. This produces exactly the full set of entrypoints as per Michelson spec. 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. 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.,morley Version of   for plain untyped type.Note that this function does not handle implicit default entrypoint, in all likelihood you want to use  .  : Safe-Inferred;!#$%&'(),./01245789:;<>?G&,morley? morleyUpdate the node at index ix of a right-combed pair. morleyGet the node at index ix of a right-combed pair. morley Splits a right-combed pair into n elements. UnpairN (ToPeano 3) ('TPair 'TInt ('TPair 'TString 'TUnit)) ~ '[ 'TInt, 'TString, 'TUnit] UnpairN (ToPeano 3) ('TPair 'TInt ('TPair 'TString ('TPair 'TUnit 'TInt))) ~ '[ 'TInt, 'TString, 'TPair 'TUnit 'TInt] morley'Folds a stack into a right-combed pair. RightComb '[ 'TInt, 'TString, 'TUnit ] ~ 'TPair 'TInt ('TPair 'TString 'TUnit) morleyConstraint that is used in DUG, we want to share it with typechecking code and eDSL code. morleyConstraint that is used in DIG, we want to share it with typechecking code and eDSL code. morleyConstraint that is used in DIPN, we want to share it with typechecking code and eDSL code. morleyConstraint that is used in DUPN, we want to share it with typechecking code and eDSL code.  < Safe-Inferred;!#$%&'(),./01245789:;<>?˯  = Safe-Inferred;!#$%&'(),./01245789:;<>?: 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   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 Safe-Inferred;!#$%&'(),./01245789:;<>?؍ 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 Convert a   to raw bytes.,morleyBase16 format is 11a2e0c9 morley$Sign a message using the secret key. morleyCheck that a sequence of bytes has been signed with a given key.  ? Safe-Inferred;!#$%&'(),./01245789:;<>? 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 Convert a   to raw bytes.,morleyBase16 format is 1051eebd morley$Sign a message using the secret key. morleyCheck that a sequence of bytes has been signed with a given key.  @ Safe-Inferred;!#$%&'(),./01245789:;<>?8 morley ED25519 cryptographic signature. morley!ED25519 secret cryptographic key. morley!ED25519 public cryptographic key. morley1Deterministicaly generate a secret key from seed. morleyGenerate a random secret key. 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.  A Safe-Inferred;!#$%&'(),./01245789:;<>? morley"BLS-MinPk cryptographic signature. morley#BLS-MinPk secret cryptographic key. morley#BLS-MinPk public cryptographic key.,morley#Domain separation tag used by tezos morley1Deterministicaly generate a secret key from seed. morleyGenerate a random secret key. morley&Create a public key from a secret key. morley Convert a   to raw bytes.,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.  B Safe-Inferred<!#$%&'(),./01245789:;<=>?)morley+What specific type of hash is used for the .morley"Type of public/secret key as enum.morleyA kind of a hash.morleyPublic key hash for tz1, tz2, tz3 addresses.morleyContract hash for KT1 smart contract addresses.morleySmart rollup hash for sr1 addresses.morley,Convenience synonym for a smart rollup hash.morley(Convenience synonym for a contract hash.morley4Convenience synonym for an on-chain public key hash.morleyBlake2b_160 hash of something.morleyWhich kind of hash.morley Hash itself.morley List all s for a given .morley2A compatibility synonym for a public key hash tag.morleyCryptographic signatures used by Tezos. Constructors correspond to  constructors.Tezos distinguishes signatures for different curves. For instance, ed25519 signatures and secp256k1 signatures are printed differently (have different prefix). However, signatures are packed without information about the curve. For this purpose there is a generic signature which only stores bytes and doesn't carry information about the curve. Apparently unpacking from bytes always produces such signature. Unpacking from string produces a signature with curve information.morley4Signature that uses the ed25519 cryptographic curve.morley6Siganture that uses the secp256k1 cryptographic curve.morley7Signature that uses the NIST P-256 cryptographic curve.morley6Signature that uses the BLS12-381 cryptographic curve.morley-Generic signature for which curve is unknown.morleySecret cryptographic key used by Tezos. Constructors correspond to  constructors.morley5Secret key that uses the ed25519 cryptographic curve.morley7Secret key that uses the secp256k1 cryptographic curve.morley8Secret key that uses the NIST P-256 cryptographic curve.morley%Secret key that uses BLS12-381 curve.morleyPublic cryptographic key used by Tezos. There are three cryptographic curves each represented by its own constructor.morley5Public key that uses the ed25519 cryptographic curve.morley7Public key that uses the secp256k1 cryptographic curve.morley8Public key that uses the NIST P-256 cryptographic curve.morley7Public key that uses the BLS12-381 cryptographic curve.morleyDeterministically generate a secret key from seed. Key type is specified explicitly.morleyDeterministically generate a secret key from seed. Type of the key depends on seed value.morley&Create a public key from a secret key.morley Convert a  to raw bytes.morleyMake a " from raw bytes. Can return only  or morleyCheck that a sequence of bytes has been signed with a given key.morleyParse  unencrypted secret key. It accepts formats containing either with or without the  unecrypted prefix.morleyLength of a hash in bytes (only the hash itself, no tags, checksums or anything).morley*Compute the b58check of a public key hash.morleyParse a  of any known kind from its its human-readable textual representation.,morleyMagic constants used by Tezos to encode hashes with proper prefixes.`abcde  `aebdc C Safe-Inferred;!#$%&'(),./01245789:;<>?VmorleyIdentifier 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).The constructor is marked Unsafe since GHC does not warn on overflowing literals (exceeding custom ,# type bounds), thus the resultant " value may get truncated silently.UnsafeMutez 9223372036854775809UnsafeMutez {unMutez = 1}morley Quotes a  value.The value is in XTZ, i.e. 1e6 +, with optional suffix representing a unit:k, kilo -- 1000 XTZM, Mega, mega -- 1000000 XTZm, milli -- 0.001 XTZu, , micro -- 0.000001 XTZ1This is the safest and recommended way to create  from a numeric literal.The suffix can be separated from the number by whitespace. You can also use underscores as a delimiter (those will be ignored), and scientific notation, e.g.  123.456e6. Note that if the scientific notation represents a mutez fraction, that is a compile-time error. [tz|123|]!UnsafeMutez {unMutez = 123000000} [tz|123k|]$UnsafeMutez {unMutez = 123000000000}[tz|123 kilo|]$UnsafeMutez {unMutez = 123000000000} [tz|123M|]'UnsafeMutez {unMutez = 123000000000000}[tz|123 Mega|]'UnsafeMutez {unMutez = 123000000000000}[tz|123 mega|]'UnsafeMutez {unMutez = 123000000000000} [tz|123e6|]'UnsafeMutez {unMutez = 123000000000000} [tz|123m|]UnsafeMutez {unMutez = 123000}[tz|123 milli|]UnsafeMutez {unMutez = 123000} [tz|123u|]UnsafeMutez {unMutez = 123} [tz|123|]UnsafeMutez {unMutez = 123}[tz|123 micro|]UnsafeMutez {unMutez = 123}[tz| 123.456_789 |]!UnsafeMutez {unMutez = 123456789}[tz|123.456u|]... ... error:... @ The number is a mutez fraction. The smallest possible subdivision is 0.000001 XTZ...[tz|0.012_345_6|]... ... error:... @ The number is a mutez fraction. The smallest possible subdivision is 0.000001 XTZ...[tz| 9223372.036854775807 M |]+UnsafeMutez {unMutez = 9223372036854775807}[tz| 9223372.036854775808 M |]... ... error:... @ The number is out of mutez bounds. It must be between 0 and 9223372036854.775807 XTZ (inclusive).... [tz| -1 |]... ... error:... @ The number is out of mutez bounds. It must be between 0 and 9223372036854.775807 XTZ (inclusive)....morleySafely creates  checking for overflow and underflow. Accepts a number of any type.morleySafely create .When constructing literals, you'll need to specify the type of the literal. GHC will check for literal overflow on builtin types like , and , , but not on , or ,!, so those can overflow silently.It's recommended to use ! quasiquote for literals instead.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 [tz|420u|] 0.00042 putTextLn $ prettyTez [tz|42|]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.?p  E Safe-Inferred<!#$%&'(),./01245789:;<=>?8!morley&A "kinded" address. This type carries  on the type-level. Useful in the internal API, not as much when we have to interact with the network. See / for a type that is isomorphic to a Michelson address.morleytz1, tz2 or tz3) address which is a hash of a public key.morleyKT12 address which corresponds to a callable contract.morley:Raw bytes representation of an address has invalid length.morleyRaw bytes representation of an address does not end with "00".morleyGeneral binary decoding error.morley!Crypto error in parsing key hash.morley.Errors that can happen during address parsing.morley+The address parsers failed with some error.morley#The parsed address is of wrong kindmorley(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.morleyConvenience synonym for 0 allowing only implicit and contract addresses..For a note on the naming convention, refer to .morleyA convenience synonym for 0 allowing only implicit and contract addresses. is named as such because in addition to implicit and contract addresses, Michelson's address type can contain txr1 or sr1 addresses, identifying respectively transaction rollups and smart rollups. While they are technically also level-1 (level-2 being tx_rollup_l2_address), in practice It's level-1 identifiers for bundles of level-2 operations. Hence, to keep type names concise, we use .morleyAn existential of " constrained by its type argument.morley:Constrain address kind to be one of the kinds in the list.morleyData type corresponding to address structure in Tezos.morleyA type only allowing morleyA type only allowing morleyA type only allowing morley specialized to morley4A trick to avoid bogus redundant constraint warningsmorleyGiven any (non-bottom)  , prove that kind is well-defined (i.e. has a , instance)morleyChecks if the provided  is an implicit address and returns proof of the fact if it is.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 of a particular kind from its human-readable textual representation used by Tezos (e. g. "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU"). Or fail if it's invalid.morley Parse an  of the given kinds from its human-readable textual representation. Maybe fail with a / in case the address parsed is of wrong kind.morleyParse an address of arbitrary kind from its human-readable textual representation, 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-QuasiQuoter for constructing Tezos addresses.3Validity of result will be checked at compile time.,-F Safe-Inferred;!#$%&'(),./01245789:;<>?! morleyA type only allowing  values.morleyA type only allowing  values.morley octez-client can associate addresses with textual aliases. This type denotes such an alias.morleyThis type is meant to be used to parse CLI options where either an address or an alias of an implicit account or a contract can be accepted.0This can be later converted to an address using Morley.Client.resolveAddress or an alias using Morley.Client.getAlias./This polymorphic type can be instantiated with  or  (see  and  ), but not . There is no  octez-client. command to list smart rollup aliases, unlike +octez-client list known addresses/contracts , therefore: %It wouldn't be possible to implement Morley.Client.resolveAddress for 5AddressAlias _ :: AddressOrAlias 'AddressKindTxRollup.%It wouldn't be possible to implement Morley.Client.getAlias for 8AddressResolved _ :: AddressOrAlias 'AddressKindTxRollup.!This should be revisited if/when  octez-client' adds support for smart rollup aliases.morleyExistential wrapper over .morleyGet raw alias text from morley Construct an  from alias +.morley Given an  , prove it's kind is well-defined (i.e. it has a , instance and satisfies  constraint)morley Given an  , prove it's kind is well-defined (i.e. it has a , instance and satisfies  constraint)morleyThe prefix used to specify whether an alias belongs to a contract or an implicit account.morleyThe output of , should be parseable by the   instance.morley"Address itself, can be used as is.morley%Address alias, should be resolved by  octez-client.G Safe-Inferred;!#$%&'(),./01245789:;<>?& 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 ValuemorleyHelper functions to render ValuesmorleyHelper functions to render ValuesmorleyHelper functions to render Values,morley3Helper function to format container values such as Some and Right.morleyHelper function to render Pair ValuemorleyHelper function to render Eltmorley 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.I Safe-Inferred;!#$%&'(),./01245789:;<>?(pmorleyName 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.morley8Valid view names form a subset of valid Michelson texts.  J Safe-Inferred;!#$%&'(),./01245789:;<>?*morley"Errors possible when constructing ViewsSet.morleyType for intermediate coercions between typed and untyped view sets. Intended as an internal helper.morley"Convenience function to construct .morley No views.morleyAdd a view to set.morleyFind a view in the set.morley!Get all taken names in views set.  H Safe-Inferred;!#$%&'(),./01245789:;<>?+morleyUntyped view in a contract.morley View namemorleyView argument typemorleyView return typemorley View codeK Safe-Inferred;!#$%&'(),./01245789:;<>?1morley'Contract block, convenient when parsingmorleyTop-level entries order of the contract. This is preserved due to the fact that it affects the output of pretty-printing and serializing contract.morleyHelper to construct  from an ordered list of entires. Duplicate entires are ignored.morley9The canonical entries order which is ordered as follow:  parameter, storage, and code.morley(General untyped contract representation.morleyContract parameter typemorleyContract storage typemorley%Contract code as a list of operationsmorleyOriginal order of contract blocks, so that we can print them in the same order they were readmorleyContract viewsmorleyConvenience synonym for  representing the storage typemorleyConstruct 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.morleyMap each contract fields by the given function and sort the output based on the .morley3Map all the instructions appearing in the contract.  L Safe-Inferred;!#$%&'(),./01245789:;<>?7morley.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).M Safe-Inferred;!#$%&'(),./01245789:;<>?: Safe-Inferred;!#$%&'(),./01245789:;<>?:gjhiklmnopqrstuxvwyz{|}~ N Safe-Inferred<!#$%&'(),./01245789:;<=>?Fmorley>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.morleyA typed heterogenous list of annotations. Simplified pattern synonyms for common use cases are provided.morleyForget information about annotations, pick singleton with the same type.morleyGet term-level type of notes.morley9Get the term-level type of notes, preserving annotations.morley In memory of NStar5 constructor. Generates notes with no annotations.morley%Checks if no annotations are present.morleyConvenience pattern synonym matching three simple annotations.morleyConvenience pattern synonym matching two annotations, first being a simple one, the second being &, corresponding to an annotated type.morley?J"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.P Safe-Inferred<!#$%&'(),./01245789:;<=>?R;morley%Simple expression without any extras.morleyExtension descriptor for plain expressions without additional data.morley:A helper type that carries something for all extra fields.(Fields are carried in the given functor f so that one could provide a generator, parser or something else.Extra constructor is not included here as it may need special treatment, you have to carry it separately.morleyConstraint all the extra fields and the constructor provided by this extension.morley;Constraint all the extra fields provided by this extension.morley(Defines details of extension descriptor.morleyAdditional data in  constructor.morleyAdditional data in  constructor.morleyAdditional data in  constructor.morleyAdditional data in  constructor.morleyAdditional data in  constructor.morleyAdditional constructors.morleyKind of extension descriptors.0We use a dedicated open type for this, not just Type8, to notice earlier when type arguments are mis-placed.morley4Type for Micheline Expression with extension points.Following the Trees-that-Grow approach, this type provides the core set of constructors used by Tezos accompanied with additional data (XExp*-). Plus additional constructors provided by XExp.The type argument x will be called extension descriptor and it must have ExpExtensionDescriptor instance.morleyFill  with the same data, assuming all types of extras are the same.morleyChange the functor used in .morleyDefault instance that uses uniplate as implementation.If it tries to find expressions for polymorphic types too agressively (requiring , where you don't what that), feel free to define an overlapping manual instance.Q Safe-Inferred;!#$%&'(),./01245789:;<>?Wmorley%Alias for expression with given meta.morleyExpression that has the same type of metadata attached to each of its constructors.morley,Traversal that visits all the extra fields ( and others) in DFS order assuming they are the same for every constructor.+It is generic enough to work not only with , but with any  that has all the extra fields of the same type; hence, this traversal is applicable to  too.0This also supports additional constructors. Use , if you have none.>Moreover, when used as setter, it can change the type of meta.morley,Lens for getting immediate meta of the node.morleyTraversal that visits all the metas in DFS order. This is a specialization of .This is pretty similar to 1, but picks meta of all the transitive children.4When used as setter, it can change the type of meta.morley Lift plain  to .R Safe-Inferred;!#$%&'(),./01245789:;<>?XmorleyEncode  to ,.morleySame as , for strict bytestring.morleyDecode  from ,.morleyPartial version of . Safe-Inferred;!#$%&'(),./01245789:;<>?Yx  S Safe-Inferred;!#$%&'(),./01245789:;<>?[morley2Where a contract or value in Michelson comes from.morleyFrom given file.morleyOnly source name is known.morleyDefined in Haskell code.morleySome unknown source.morley%Designates command line input source.morley Designates stdin source.morley% that points to the current position.  T Safe-Inferred;!#$%&'(),./01245789:;<>?\$  U Safe-Inferred;!#$%&'(),./01245789:;<>?^morley Version of , returning a , listmorley Version of , returning a , listmorley Version of , returning a , listmorley endBy2 p sep# parses two or more occurrences of p, separated by sep.morley8Apply given parser and return default value if it fails.morleyParse expression n times, where n? is a type-level natural. Essentially, a type-safe version of ,8, but requires the count to be known on the type level.V Safe-Inferred;!#$%&'(),./01245789:;<>?amorley General TV2F Annotation parser, including Special AnnotationsmorleyParse arbitrary annotation.morleyParse 012 var anns and 012 field anns. It doesn't matter which come first, so long as annotations of the same type appear together.E.g.: "" is valid "%a" is valid"%a @c" is valid"%a %b c  d" is valid"c d %a %b" is valid"c %a %b d" is not valid, because the two var anns are not "grouped" together."%a c d %b" is not valid, because the two fields anns are not "grouped" together.W Safe-Inferred;!#$%&'(),./01245789:;<>?cumorley'This parses arbitrary type expressions.=Note that this includes parenthesized ones. That is to say, int, (int), ((int))., etc will match with this parser and produce TInt.,morley Parses a unit type.X Safe-Inferred;!#$%&'(),./01245789:;<>?cY Safe-Inferred;!#$%&'(),./01245789:;<>?f morley"Views that belong to one contract.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. "Z Safe-Inferred;!#$%&'(),./01245789:;<>?hQmorleyBuilding 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.[ Safe-Inferred;!#$%&'(),./01245789:;<>?i!morleyProduce ( instance for tuple of the given length.\ Safe-Inferred;!#$%&'(),./01245789:;<>?i Safe-Inferred;!#$%&'(),./01245789:;<>?j Safe-Inferred;!#$%&'(),./01245789:;<>?obmorleySuppose 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.   ] Safe-Inferred;!#$%&'(),./01245789:;<>?|bmorleyDescribes 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