summaryrefslogtreecommitdiff
path: root/Hero
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-29 02:37:14 -0500
committerBen Sima <ben@bsima.me>2021-01-29 03:22:01 -0500
commitb289dee25ad8ce4c2622fadb2f4c31fb90914b39 (patch)
tree5511da780cdabbb98c8fbe01f03997d3263e7880 /Hero
parent42c7614b6a4bd7504e9bf31e0882db58b85857bc (diff)
Lint 'return' into 'pure', replace bind operator
Diffstat (limited to 'Hero')
-rw-r--r--Hero/Host.hs12
-rw-r--r--Hero/Keep.hs2
-rw-r--r--Hero/Node.hs6
3 files changed, 10 insertions, 10 deletions
diff --git a/Hero/Host.hs b/Hero/Host.hs
index fd010af..5496f27 100644
--- a/Hero/Host.hs
+++ b/Hero/Host.hs
@@ -106,7 +106,7 @@ move _ = bracket startup shutdown run
run (cfg, app, _) = Warp.run (heroPort cfg) app
prn = IO.hPutStrLn IO.stderr
startup =
- Envy.decodeEnv >>= \case
+ Envy.decodeEnv +> \case
Left e -> Exit.die e
Right cfg ->
do
@@ -139,7 +139,7 @@ move _ = bracket startup shutdown run
:<|> wrapAuth appHostHandlers
-- fall through to 404
:<|> Tagged handle404
- return
+ pure
( cfg,
serveWithContext
proxy
@@ -150,11 +150,11 @@ move _ = bracket startup shutdown run
shutdown :: App -> IO ()
shutdown (_, _, keep) = do
Keep.close keep
- return ()
+ pure ()
upsertKey :: FilePath -> IO Crypto.JWK
upsertKey fp =
- Directory.doesFileExist fp >>= \exists ->
+ Directory.doesFileExist fp +> \exists ->
if exists
then Auth.readKey fp
else Auth.writeKey fp >> Auth.readKey fp
@@ -229,7 +229,7 @@ type CssRoute = "css" :> "main.css" :> Get '[CSS] Text
cssHandlers :: Server CssRoute
cssHandlers =
- return <. Lazy.toStrict <. Clay.render <| Typography.main <> Look.main
+ pure <. Lazy.toStrict <. Clay.render <| Typography.main <> Look.main
type AuthRoute =
"auth"
@@ -274,7 +274,7 @@ authHandler cookieSettings jwtSettings loginForm =
mApplyCookies <- liftIO <| Auth.acceptLogin cookieSettings jwtSettings usr
case mApplyCookies of
Nothing -> throwError err401
- Just applyCookies -> return <| applyCookies usr
+ Just applyCookies -> pure <| applyCookies usr
-- | See also 'server' above
type AllRoutes auths =
diff --git a/Hero/Keep.hs b/Hero/Keep.hs
index 744313b..10ef732 100644
--- a/Hero/Keep.hs
+++ b/Hero/Keep.hs
@@ -66,7 +66,7 @@ newComic :: Comic -> Update HeroKeep Comic
newComic c = do
keep <- get
put <| keep {_comics = IxSet.insert c (_comics keep)}
- return c
+ pure c
getComics :: Int -> Acid.Query HeroKeep [Comic]
getComics n = ask /> _comics /> IxSet.toList /> take n
diff --git a/Hero/Node.hs b/Hero/Node.hs
index e7eb687..a453a01 100644
--- a/Hero/Node.hs
+++ b/Hero/Node.hs
@@ -193,7 +193,7 @@ move ValidateUserPassword form =
doLogin = do
user <- getValue =<< Document.getElementById "user"
pass <- getValue =<< Document.getElementById "pass"
- sendLogin (ms user) (ms pass) >>= \case
+ sendLogin (ms user) (ms pass) +> \case
Network.Success _ -> pure NoOp
-- TODO: handle these error cases
Network.Loading -> pure NoOp
@@ -202,7 +202,7 @@ move ValidateUserPassword form =
fetchComics :: IO (Network.RemoteData MisoString [Comic])
fetchComics =
- Ajax.xhrByteString req /> Ajax.contents >>= \case
+ Ajax.xhrByteString req /> Ajax.contents +> \case
Nothing ->
pure <| Network.Failure "Could not fetch comics from server."
Just json ->
@@ -231,7 +231,7 @@ sendLogin ::
User
)
sendLogin u p =
- Ajax.xhrByteString req /> Ajax.contents >>= \case
+ Ajax.xhrByteString req /> Ajax.contents +> \case
Nothing ->
pure <| Network.Failure "Could not send login request."
Just json ->