summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs23
1 files changed, 18 insertions, 5 deletions
diff --git a/Types.hs b/Types.hs
index 7837f71..b7c5f32 100644
--- a/Types.hs
+++ b/Types.hs
@@ -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)