summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-11 13:12:37 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-11 15:31:26 -0400
commitbf71e5f4d875806e8f2623d95545c8b7a7c2d8f4 (patch)
treef7fa8439df3c89b592c89db0408324c8951c7f51 /Types.hs
downloaddebug-me-bf71e5f4d875806e8f2623d95545c8b7a7c2d8f4.tar.gz
some basic data types and hashing to start debug-me
This commit was sponsored by Denis Dzyubenko on Patreon.
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Types.hs b/Types.hs
new file mode 100644
index 0000000..c41e30a
--- /dev/null
+++ b/Types.hs
@@ -0,0 +1,35 @@
+module Types where
+
+import Data.ByteString
+import Crypto.Hash as H
+
+-- | Things that the developer sees.
+data Seen = Seen
+ { seenData :: ByteString
+ }
+ deriving (Show)
+
+-- | Things that the developer enters.
+data Entered = Entered
+ { enteredData :: ByteString
+ , echoData :: ByteString
+ -- ^ Data that is expected to be Seen, but has not been received
+ -- at the time this was entered.
+ }
+ deriving (Show)
+
+-- | An 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 a HashPointer Signature
+ | StartActivity a Signature
+ deriving (Show)
+
+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)