summaryrefslogtreecommitdiff
path: root/Biz/Ibb/Move.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-15 10:06:24 -0700
committerBen Sima <ben@bsima.me>2020-04-15 10:07:02 -0700
commitafa9d701538b9e56622a0bfdf8e04aa358c9cd82 (patch)
treedee95c3955b3fe3d11e80d89823660d28eee0587 /Biz/Ibb/Move.hs
parentf4b8c0df041b063c0b47d2ec6c818a9c202fd833 (diff)
Reformatting
Now I'm using ormolu instead of brittany for Haskell formatting now. Figured I should just make all of these big changes at once.
Diffstat (limited to 'Biz/Ibb/Move.hs')
-rw-r--r--Biz/Ibb/Move.hs62
1 files changed, 33 insertions, 29 deletions
diff --git a/Biz/Ibb/Move.hs b/Biz/Ibb/Move.hs
index 1e635ac..0dec4e5 100644
--- a/Biz/Ibb/Move.hs
+++ b/Biz/Ibb/Move.hs
@@ -1,34 +1,36 @@
-{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoImplicitPrelude #-}
-- | App update logic
module Biz.Ibb.Move
- ( move
- -- * Server interactions
- , fetchPeople
+ ( move,
+
+ -- * Server interactions
+ fetchPeople,
)
where
-import Alpha
-import Biz.Ibb.Core as Core
-import Network.RemoteData
-import Data.Aeson
-import JavaScript.Web.XMLHttpRequest ( Request(..)
- , Method(GET)
- , RequestData(NoData)
- , contents
- , xhrByteString
- )
-import Miso
-import Miso.String
+import Alpha
+import Biz.Ibb.Core as Core
+import Data.Aeson
+import JavaScript.Web.XMLHttpRequest
+ ( Method (GET),
+ Request (..),
+ RequestData (NoData),
+ contents,
+ xhrByteString,
+ )
+import Miso
+import Miso.String
+import Network.RemoteData
move :: Action -> Model -> Effect Action Model
-move Nop m = noEff m
-move (HandleRoute u) m = m { uri = u } <# pure Nop
+move Nop m = noEff m
+move (HandleRoute u) m = m {uri = u} <# pure Nop
move (ChangeRoute u) m = m <# do
pushURI u >> pure Nop
-move FetchPeople m = m <# (SetPeople </ fetchPeople)
-move (SetPeople ps) m = noEff m { people = ps }
+move FetchPeople m = m <# (SetPeople </ fetchPeople)
+move (SetPeople ps) m = noEff m {people = ps}
fetchPeople :: IO (WebData [Core.Person])
fetchPeople = do
@@ -37,12 +39,14 @@ fetchPeople = do
Nothing -> pure $ Failure "could not read from server"
Just a ->
pure $ fromEither $ either (Left . ms) pure $ eitherDecodeStrict a
- where
- req = Request { reqMethod = GET
- -- FIXME: can replace this hardcoding with a function?
- , reqURI = "/api/people"
- , reqLogin = Nothing
- , reqHeaders = []
- , reqWithCredentials = False
- , reqData = NoData
- }
+ where
+ req =
+ Request
+ { reqMethod = GET,
+ -- FIXME: can replace this hardcoding with a function?
+ reqURI = "/api/people",
+ reqLogin = Nothing,
+ reqHeaders = [],
+ reqWithCredentials = False,
+ reqData = NoData
+ }