Skip to content

Commit

Permalink
refactor: AppDataValue into a record
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Nov 8, 2024
1 parent b68b5c7 commit 2bed1dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Anoma/Transaction/AppData.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ type AppDataKey := mkAppDataKey@{unAppDataKey : Nat};
--- A data type encoding the lookup value of application data.
--- TODO Add an equivalent to `anomaEncode` and `anomaDecode` to be able to change this to ;ByteArray;.
type AppDataValue :=
mkAppDataValue@{unAppDataValue : Pair Nat DeletionCriterion};
mkAppDataValue@{
value : Nat;
deletionCriterion : DeletionCriterion;
};

--- A type describing an app data map.
AppData : Type := Map AppDataKey AppDataValue;
Expand Down Expand Up @@ -58,7 +61,10 @@ end;
module AppDataValueInternal;
--- Compares two ;AppDataValue;s.
compare (lhs rhs : AppDataValue) : Ordering :=
Ord.cmp (AppDataValue.unAppDataValue lhs) (AppDataValue.unAppDataValue rhs);
let
prod (value : AppDataValue) : _ :=
AppDataValue.value value, AppDataValue.deletionCriterion value;
in Ord.cmp (prod lhs) (prod rhs);

--- Implements the ;Ord; trait for ;AppDataValue;.
instance
Expand Down

0 comments on commit 2bed1dd

Please sign in to comment.