Make an Indigo-specific fromInteger
Clarification and motivation
Indigo code often requires to specify type signatures to numeric literals in its expressions.
Moreover, 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 1 NatType
.
It should be possible in this way to cover all 3 numeric type used in Indigo (Integer
, Natural
and Mutez
), ideally using disambiguating names matching Michelson's corresponding types (int
, nat
, mutez
)
Acceptance criteria
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.