diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-17 12:07:02 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-17 12:10:16 -0400 |
commit | daf79506ba6ac9fa6b795ad2a19684288b367a92 (patch) | |
tree | 5cc347e0e8b08489452ccd1472c4d6f4b4c065cc /Types.hs | |
parent | 8efda806c4dbb9d0acf069a34318a34e6f2bce86 (diff) | |
download | debug-me-daf79506ba6ac9fa6b795ad2a19684288b367a92.tar.gz |
add Rejected and tag hashes by type
Need a way for the user to indicate when an Activity Entered is Rejected.
Changed hashing to include type tags, so Acticity Entered and Activity
Seen can never hash to the same hash.
Got debug-me.hs to compile after these changes, but currently it's buggy
after Activity Entered is Rejected.
Started protocol.txt documentation.
This commit was sponsored by Francois Marier on Patreon.
Diffstat (limited to 'Types.hs')
-rw-r--r-- | Types.hs | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -37,12 +37,25 @@ data Entered = Entered instance ToJSON Entered instance FromJSON Entered --- | An activity (either Entered or Seen) with a pointer +-- | High level protocol. +data Proto a + = Proto a + -- ^ either Entered or Seen + | Rejected (Activity Entered) + -- ^ sent by user to indicate when an Entered value was rejected. + deriving (Show, Generic) + +instance ToJSON (Proto Seen) +instance FromJSON (Proto Seen) +instance ToJSON (Proto Entered) +instance FromJSON (Proto Entered) + +-- | A Proto activity (either Entered or Seen) with a pointer -- to the Activity before this one. -- -- The Signature is over both the data in the activity, and its pointer. data Activity a = Activity - { activity :: a + { activity :: Proto a , prevActivity :: (Maybe Hash) , signature :: Signature } @@ -53,14 +66,14 @@ instance FromJSON (Activity Seen) instance ToJSON (Activity Entered) instance FromJSON (Activity Entered) --- | A log of Activity both Entered and Seen. +-- | A log of Activity both Entered and Seen, which can be recorded to +-- prove what happened in a debug-me session. data ActivityLog = ActivitySeen { activitySeen :: (Activity Seen, Hash) } | ActivityEntered - { activityEnteredAccepted :: Bool - , activityEntered :: (Activity Entered, Hash) + { activityEntered :: (Activity Entered, Hash) } deriving (Show, Generic) |