diff options
author | Ben Sima <ben@bsima.me> | 2020-03-27 12:07:16 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-03-28 18:18:17 -0700 |
commit | 9f9dcf54c3adb45012dd01dfd8137764046c968f (patch) | |
tree | 46bc1295db4ccd87de7b58fc283424bdef67d09c /Com/InfluencedByBooks | |
parent | 0bbc82c83043102b3ba1f1a8c1608e92c65ec225 (diff) |
Add onomatopoeitic operators
It's easier to remember what operators do, and thus easier to write and
read condens code, if they follow some symbolic pattern or visually
represent the concept to which they map. This is in part inspired by
hoon, in part by OCaml's operators.
I'm not married to these operators specifically, but I think they are
good so far.
Diffstat (limited to 'Com/InfluencedByBooks')
-rw-r--r-- | Com/InfluencedByBooks/Core.hs | 4 | ||||
-rw-r--r-- | Com/InfluencedByBooks/Move.hs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Com/InfluencedByBooks/Core.hs b/Com/InfluencedByBooks/Core.hs index 1a8bf6f..6984004 100644 --- a/Com/InfluencedByBooks/Core.hs +++ b/Com/InfluencedByBooks/Core.hs @@ -100,7 +100,7 @@ see m = div_ [ class_ "container mt-5" ] NotAsked -> [ text "Initializing..." ] Loading -> [ text "Loading..." ] Failure err -> [ text err ] - Success ps -> seePerson /@ ps + Success ps -> seePerson </ ps ] seePerson :: Person -> View Action @@ -115,7 +115,7 @@ seePerson person = div_ [ class_ "card" ] ] , p_ [ class_ "card-text" ] [ text $ ms $ _blurb person - , ul_ [] $ seeBook /@ _books person + , ul_ [] $ seeBook </ _books person ] ] ] diff --git a/Com/InfluencedByBooks/Move.hs b/Com/InfluencedByBooks/Move.hs index 3baafc6..d6cb12e 100644 --- a/Com/InfluencedByBooks/Move.hs +++ b/Com/InfluencedByBooks/Move.hs @@ -20,12 +20,12 @@ move :: Action -> Model -> Effect Action Model 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 FetchPeople m = m <# (SetPeople </ fetchPeople) move (SetPeople ps) m = noEff m { people = ps } fetchPeople :: IO (WebData [Core.Person]) fetchPeople = do - mjson <- contents /@ xhrByteString req + mjson <- contents </ xhrByteString req case mjson of Nothing -> pure $ Failure "could not read from server" Just a -> pure |