Make an Indigo-specific fromInteger
Clarification and motivation
Indigo code often requires to specify type signatures to numeric literals in its expressions.
Mutex are even harder to create.
This is especially daunting to newcomers that are not fluent in Haskell.
However Indigo uses
RebindableSyntax, which allows to use whatever
fromInteger is in scope to resolve numeric literals.
This can be defined in a typeclass and with a signature that looks like:
fromInteger :: Integer -> NumericType -> a
that allows for disambiguation with the additional
NumericType (which does not exist yet, its just an example name).
This can be used to replace
(1 :: Natural) with something like
It should be possible in this way to cover all 3 numeric type used in Indigo (
Mutez), ideally using disambiguating names matching Michelson's corresponding types (
In Indigo code it should be possible to write a numeric literal followed by a disambiguation value, and have it resolved to the correct type, without having to provide a type signature or use a constructor.