From d763e27bb2b92bf17bcbd825476418305455c4f9 Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Sun, 7 Dec 2014 21:32:36 -0800 Subject: [PATCH] More readable conditional --- src/App.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/App.hs b/src/App.hs index 92b765e73..473024ace 100644 --- a/src/App.hs +++ b/src/App.hs @@ -133,12 +133,13 @@ app req = else do tableCols <- map (cs . colName) <$> columns qt let cols = map cs $ keys obj - if S.fromList tableCols == S.fromList cols then do - let vals = elems obj - H.unit . coerce $ iffNotT - (whereT qq $ update qt cols vals) - (insertSelect qt cols vals) - return $ responseLBS status204 [ jsonH ] "" + if S.fromList tableCols == S.fromList cols + then do + let vals = elems obj + H.unit . coerce $ iffNotT + (whereT qq $ update qt cols vals) + (insertSelect qt cols vals) + return $ responseLBS status204 [ jsonH ] "" else return $ if Prelude.null tableCols then responseLBS status404 [] ""