+ }
+
+-- | Constant-time Eq instance
+instance Eq Macaroon where
+ (MkMacaroon l1 i1 c1 s1) == (MkMacaroon l2 i2 c2 s2) =
+ (l1 `constEqBytes` l2) &&!
+ (i1 `constEqBytes` i2) &&!
+ (c1 == c2) &&!
+ (s1 `constEqBytes` s2)
+
+
+-- | show instance conforming to the @inspect@ "specification"
+instance Show Macaroon where
+ -- We use intercalate because unlines would add a trailing newline
+ show (MkMacaroon l i c s) = intercalate "\n" [
+ "location " ++ B8.unpack l
+ , "identifier " ++ B8.unpack i
+ , intercalate "\n" (map show c)
+ , "signature " ++ B8.unpack (hex s)
+ ]
+
+-- | NFData instance for use in the benchmark