-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9fcf07
commit 1442827
Showing
5 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module Anoma.Transaction.CustomInputs; | ||
|
||
import Stdlib.Prelude open; | ||
import Stdlib.Trait.Ord.Eq open using {fromOrdToEq}; | ||
import Stdlib.Data.Map as Map open using {Map}; | ||
import Anoma.Builtin.ByteArray open using {ByteArray}; | ||
import Anoma.Utils open; | ||
|
||
--- A data type encoding the lookup key of application. | ||
type CustomInputsKey := mkCustomInputsKey@{unCustomInputsKey : ByteArray}; | ||
|
||
--- A data type encoding the lookup value of application data. | ||
type CustomInputsValue := mkCustomInputsValue@{unCustomInputsValue : ByteArray}; | ||
|
||
--- A type describing an app data map. | ||
CustomInputs : Type := Map CustomInputsKey CustomInputsValue; | ||
|
||
--- A module implementing traits for ;CustomInputsKey;. | ||
module CustomInputsKeyInternal; | ||
--- Compares two ;CustomInputsKey;s. | ||
compare (lhs rhs : CustomInputsKey) : Ordering := | ||
Ord.cmp | ||
(CustomInputsKey.unCustomInputsKey lhs) | ||
(CustomInputsKey.unCustomInputsKey rhs); | ||
|
||
--- Implements the ;Ord; trait for ;CustomInputsKey;. | ||
instance | ||
CustomInputsKey-Ord : Ord CustomInputsKey := mkOrd compare; | ||
|
||
--- Implements the ;Eq; trait for ;CustomInputsKey;. | ||
instance | ||
CustomInputsKey-Eq : Eq CustomInputsKey := fromOrdToEq; | ||
end; | ||
|
||
--- A module implementing traits for ;CustomInputsValue;. | ||
module CustomInputsValueInternal; | ||
--- Compares two ;CustomInputsValue;s. | ||
compare (lhs rhs : CustomInputsValue) : Ordering := | ||
Ord.cmp | ||
(CustomInputsValue.unCustomInputsValue lhs) | ||
(CustomInputsValue.unCustomInputsValue rhs); | ||
|
||
--- Implements the ;Ord; trait for ;CustomInputsValue;. | ||
instance | ||
CustomInputsValue-Ord : Ord CustomInputsValue := mkOrd compare; | ||
|
||
--- Implements the ;Eq; trait for ;CustomInputsValue;. | ||
instance | ||
CustomInputsValue-Eq : Eq CustomInputsValue := fromOrdToEq; | ||
end; |