summaryrefslogtreecommitdiff
path: root/Biz/Ibb/Core.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-12-24 14:24:16 -0500
committerBen Sima <ben@bsima.me>2020-12-24 14:24:16 -0500
commit6eaaf3d8ce6025932990de6fa697d14c9651be76 (patch)
tree65ca4a0dd0393db98d9a6067bbbef789469e8122 /Biz/Ibb/Core.hs
parent6a4a8aa37044d578c95dea145b9605908b8dc28d (diff)
linting fixes and cleanup
Diffstat (limited to 'Biz/Ibb/Core.hs')
-rw-r--r--Biz/Ibb/Core.hs69
1 files changed, 33 insertions, 36 deletions
diff --git a/Biz/Ibb/Core.hs b/Biz/Ibb/Core.hs
index 007d835..ec6ef10 100644
--- a/Biz/Ibb/Core.hs
+++ b/Biz/Ibb/Core.hs
@@ -22,34 +22,32 @@ import Servant.Links
-- * entity data types
-data Person
- = Person
- { -- | Their full name.
- _name :: Text,
- -- | A link to their picture.
- _pic :: Text,
- -- | Their twitter handle, without the `@` prefix.
- _twitter :: Text,
- -- | Their main website, fully formed: `https://example.com`
- _website :: Text,
- -- | A short list of the books they recommend.
- _books :: [Book],
- -- | A short "about" section, like you would see on the jacket flap of a book.
- _blurb :: Text
- }
+data Person = Person
+ { -- | Their full name.
+ _name :: Text,
+ -- | A link to their picture.
+ _pic :: Text,
+ -- | Their twitter handle, without the `@` prefix.
+ _twitter :: Text,
+ -- | Their main website, fully formed: `https://example.com`
+ _website :: Text,
+ -- | A short list of the books they recommend.
+ _books :: [Book],
+ -- | A short "about" section, like you would see on the jacket flap of a book.
+ _blurb :: Text
+ }
deriving (Generic, Show, Eq, Typeable, Data, Ord)
instance FromJSON Person
instance ToJSON Person
-data Book
- = Book
- { _title :: Text,
- _author :: Text,
- -- | Amazon REF number, for creating affiliate links.
- _amznref :: Text
- }
+data Book = Book
+ { _title :: Text,
+ _author :: Text,
+ -- | Amazon REF number, for creating affiliate links.
+ _amznref :: Text
+ }
deriving (Generic, Show, Eq, Typeable, Data, Ord)
instance FromJSON Book
@@ -62,11 +60,10 @@ type AppRoutes = Home
type Home = View Action
-data Model
- = Model
- { uri :: URI,
- people :: WebData [Person]
- }
+data Model = Model
+ { uri :: URI,
+ people :: WebData [Person]
+ }
deriving (Show, Eq)
type WebData a = RemoteData MisoString a
@@ -92,7 +89,7 @@ notfound :: View Action
notfound = div_ [] [text "404"]
goHome :: URI
-goHome = linkURI $ safeLink (Proxy :: Proxy AppRoutes) (Proxy :: Proxy Home)
+goHome = linkURI <| safeLink (Proxy :: Proxy AppRoutes) (Proxy :: Proxy Home)
see :: Model -> View Action
see m =
@@ -113,7 +110,7 @@ see m =
]
]
],
- div_ [class_ "card-columns"] $ case people m of
+ div_ [class_ "card-columns"] <| case people m of
NotAsked -> [text "Initializing..."]
Loading -> [text "Loading..."]
Failure err -> [text err]
@@ -126,22 +123,22 @@ seePerson person =
[class_ "card"]
[ div_
[class_ "card-img"]
- [img_ [class_ "card-img img-fluid", src_ $ ms $ _pic person]],
+ [img_ [class_ "card-img img-fluid", src_ <| ms <| _pic person]],
div_
[class_ "card-body"]
- [ h4_ [class_ "card-title"] [text $ ms $ _name person],
+ [ h4_ [class_ "card-title"] [text <| ms <| _name person],
h6_
[]
[ a_
[ class_ "fab fa-twitter",
- href_ $ "https://twitter.com/" <> ms (_twitter person)
+ href_ <| "https://twitter.com/" <> ms (_twitter person)
]
[],
- a_ [class_ "fas fa-globe", href_ $ ms $ _website person] []
+ a_ [class_ "fas fa-globe", href_ <| ms <| _website person] []
],
p_
[class_ "card-text"]
- [text $ ms $ _blurb person, ul_ [] $ seeBook </ _books person]
+ [text <| ms <| _blurb person, ul_ [] <| seeBook </ _books person]
]
]
@@ -151,7 +148,7 @@ seeBook book =
[]
[ a_
[ class_ "text-dark",
- href_ $ "https://www.amazon.com/dp/" <> ms (_amznref book)
+ href_ <| "https://www.amazon.com/dp/" <> ms (_amznref book)
]
- [text $ ms $ _title book]
+ [text <| ms <| _title book]
]