summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-12 15:29:19 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-12 15:34:05 -0400
commit2288820b8a17cf3329b8655c4df1cff63ac735cf (patch)
tree2d1be0b4d90e3a3cdb56337fec8c5a16d87c9958 /Types.hs
parent22d0afca50ac4e43f21e34b93076b592a99eddcf (diff)
downloaddebug-me-2288820b8a17cf3329b8655c4df1cff63ac735cf.tar.gz
use Activity types for user<->developer communication
Still all in a single process with no serialization, but now there are separate threads for the user and developer sides, and they communicate Activity back and forth. Signatures are not checked yet, but both user and developer check that the other side is sending Activity that forms a valid hash chain with previous Activity. The echo simulation is included, but may be buggy. This seems to work well enough with 0 latency at least. This commit was sponsored by Thom May on Patreon.
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Types.hs b/Types.hs
index c41e30a..3061ba6 100644
--- a/Types.hs
+++ b/Types.hs
@@ -27,9 +27,13 @@ data Activity a
| StartActivity a Signature
deriving (Show)
+activityContent :: Activity a -> a
+activityContent (Activity a _ _) = a
+activityContent (StartActivity a _) = a
+
data Signature = Signature ByteString
deriving (Show)
-- | A SHA2 hash pointer to something that hashes to this value.
newtype HashPointer = HashPointer (H.Digest H.SHA256)
- deriving (Show)
+ deriving (Show, Eq)