You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But they can be combined like so, and represented on the front end with a Maybe
isAdmin(address=>uint) // returns the admins auth level, or 0 if is not an admin.
Maybe's tell us not only if something exists, but also what exists if so. It conveys multiple states in one data type. We can convey the information of two maps in one, by cleverly defining 0 as one distinct type of state, and 1..n as another type of state.
type alias AuthLevel=BigIntisAdmin:AbiDecoder (MaybeAuthLevel)
isAdmin =Abi.maybe Abi.uint
Abi.maybe might look something like.
maybe:AbiDecodera->AbiDecoder (Maybea)
maybe decoder =AbiDecoder<|\returnBlob ->case returnBlob of
0x000...->Nothing
n ->Just(decoder n)
The text was updated successfully, but these errors were encountered:
You might see mappings like this
But they can be combined like so, and represented on the front end with a
Maybe
Maybe
's tell us not only if something exists, but also what exists if so. It conveys multiple states in one data type. We can convey the information of two maps in one, by cleverly defining 0 as one distinct type of state, and 1..n as another type of state.Abi.maybe might look something like.
The text was updated successfully, but these errors were encountered: