Skip to content
Browse files

hlint

  • Loading branch information...
1 parent ad80b77 commit 343c9dc5eea190a380d93212e53a49c04950e9a8 @singpolyma committed
Showing with 10 additions and 10 deletions.
  1. +3 −3 Application.hs
  2. +3 −3 Main.hs
  3. +1 −1 Makefile
  4. +3 −3 Sqlite3.hs
View
6 Application.hs
@@ -3,7 +3,7 @@ module Application where
import Data.List (intercalate)
import Data.String (fromString)
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, maybe)
import Network.HTTP.Accept (selectAcceptType)
import Network.Wai.Parse (parseRequestBody, parseHttpAccept, getRequestBodyType, parseRequestBody, RequestBodyType(..), lbsBackEnd, fileContent)
import Network.Wai (Request(..), Response(..), Application)
@@ -91,7 +91,7 @@ assertFor root db adr req = do
-- TODO: force adr to be the address of the object
body <- case getRequestBodyType req of
- Just (Multipart _) -> fmap (fromMaybe LZ.empty . fmap (fileContent . snd) . headMay . snd) (parseRequestBody lbsBackEnd req)
+ Just (Multipart _) -> fmap (maybe LZ.empty (fileContent . snd) . headMay . snd) (parseRequestBody lbsBackEnd req)
_ -> fmap (LZ.fromChunks . (:[])) (bodyBytestring req)
result <- liftIO $ case decodeOrFail body of
@@ -113,7 +113,7 @@ assertFor root db adr req = do
(Aeson..=) (T.pack "error") (Aeson.toJSON e)
])
Right () -> json ok200 [] (Aeson.object [
- (Aeson..=) (T.pack "status") ("success")
+ (Aeson..=) (T.pack "status") "success"
])
_ -> string notAcceptable406 [] (intercalate "\n" supportedTypes)
where
View
6 Main.hs
@@ -39,7 +39,7 @@ main = do
main' (Just root@(URI {uriAuthority = Just _})) (_:dbpth:_) = do
cwd <- getWorkingDirectory
void $ withConnection dbpth
- (\db -> run 3000 $
- logStdoutDev $ autohead $ acceptOverride $ jsonp $ -- Middleware
- dispatch (staticRoot cwd) $ routes root db) -- Do routing
+ (run 3000 .
+ logStdoutDev . autohead . acceptOverride . jsonp . -- Middleware
+ dispatch (staticRoot cwd) . routes root) -- Do routing
main' _ _ = err "Usage: ./Main <Root URI> <DB path>"
View
2 Makefile
@@ -1,4 +1,4 @@
-Main: Main.hs Application.hs Routes.hs MustacheTemplates.hs PathHelpers.hs
+Main: Main.hs Application.hs Routes.hs MustacheTemplates.hs PathHelpers.hs Sqlite3.hs Keyserver.hs Assertion.hs Util.hs
ghc -Wall -fno-warn-name-shadowing Main.hs
Routes.hs: routes
View
6 Sqlite3.hs
@@ -15,14 +15,14 @@ import Records
import Assertion
issuerKeyIds :: OpenPGP.Message -> [String]
-issuerKeyIds (OpenPGP.Message ((OpenPGP.CompressedDataPacket _ (OpenPGP.Message p1)):p2)) =
+issuerKeyIds (OpenPGP.Message (OpenPGP.CompressedDataPacket _ (OpenPGP.Message p1) : p2)) =
issuerKeyIds (OpenPGP.Message (p1 ++ p2))
issuerKeyIds (OpenPGP.Message pkts) = mapMaybe OpenPGP.signature_issuer pkts
extractVerifiedAssertion :: OpenPGP.Message -> IO (Either String (OpenPGP.Packet, OpenPGP.Message, Assertion))
extractVerifiedAssertion msg = runEitherT $ do
- time <- liftIO $ getCurrentTime
- k <- noteT "Keyserver fetch failed." $ (MaybeT . fetchKey) =<< (hoistMaybe $ headMay (issuerKeyIds msg))
+ time <- liftIO getCurrentTime
+ k <- noteT "Keyserver fetch failed." $ (MaybeT . fetchKey) =<< hoistMaybe (headMay (issuerKeyIds msg))
(adr, obj@(_, _, at)) <- noteT "No valid signed object found." $ hoistMaybe $
verifyAssertion time k msg

0 comments on commit 343c9dc

Please sign in to comment.
Something went wrong with that request. Please try again.