aboutsummaryrefslogtreecommitdiff
path: root/src/Ssb/Feed.hs
diff options
context:
space:
mode:
authorCypher <cypher@server.ky>2022-05-03 15:19:21 -0500
committerCypher <cypher@server.ky>2022-05-03 15:19:21 -0500
commitc019ffde1b35cda5139ca65c80265603c23cd7b9 (patch)
treee7b3b252c8e9672a7ebdb5153f28be34935bddbd /src/Ssb/Feed.hs
parent1a10c09d6150dbc9e8a1718b710252cb7b38b776 (diff)
downloadssb-haskell-master.tar.xz
Apply lintingHEADmaster
Diffstat (limited to 'src/Ssb/Feed.hs')
-rw-r--r--src/Ssb/Feed.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Ssb/Feed.hs b/src/Ssb/Feed.hs
index ebdd2f4..57547a9 100644
--- a/src/Ssb/Feed.hs
+++ b/src/Ssb/Feed.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE GeneralisedNewtypeDeriving #-}
-
module Ssb.Feed where
import Protolude hiding ( Identity
@@ -220,7 +218,7 @@ withoutSignature buf =
$ snd
$ BS.breakSubstring (BS.reverse signaturePattern) (BS.reverse buf)
where
- appendToEnd = \x y -> BS.append y x
+ appendToEnd = flip BS.append
signaturePattern = ",\n \"signature\":"
newVerifiableMessage
@@ -251,9 +249,9 @@ atMayFeed i (Feed _ msgs) = atMay msgs i
-- verification fails.
append :: ToJSON a => Feed a -> VerifiableMessage a -> Either Text (Feed a)
append (Feed id msgs) msg = do
- if (verify id msg)
- then (return (Feed id (msgs ++ [msg])))
- else (error "verification failed")
+ if verify id msg
+ then return (Feed id (msgs ++ [msg]))
+ else error "verification failed"
appendContent :: ToJSON a => Feed a -> a -> IO (Either Text (Feed a))
appendContent (Feed id msgs) content = do
@@ -290,9 +288,9 @@ signMessage id msg = do
msg { signature = Just signature }
return $ do
vMsg' <- vMsg
- if (verify id vMsg')
- then (return vMsg')
- else (error "signing failed verification")
+ if verify id vMsg'
+ then return vMsg'
+ else error "signing failed verification"
Left err -> return $ error err
verify :: ToJSON a => Identity -> VerifiableMessage a -> Bool