aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2025-03-03 16:38:37 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2025-03-03 16:38:37 +0100
commitf9eff0b21ad4c79f0bde39bd2e8bd35bd9009c96 (patch)
treed5703bd97334df9cfbe681e6a1e5d3d13c0fcd52
parent08db7797d83cfb4a81b6c17602604a74a1747f8f (diff)
drop some braces
-rw-r--r--app/Main.hs87
1 files changed, 41 insertions, 46 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 5ac9b97..53c2521 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -100,26 +100,25 @@ component =
render :: (MonadDOM m, MonadUnliftIO m) => [Chat] -> H.ComponentHTML Action slots m
render chats =
- HH.div_
- ( fmap
- ( \(index, (Chat chatMessages draft)) ->
- HH.div_
- [ HH.div_
- ( fmap
- ( \(Message message) ->
- HH.text message
- )
- chatMessages
- ),
- HH.input
- [ HP.value draft,
- HE.onInputValueChange $ Just . (DraftChanged index),
- HE.onClick (\_ -> DraftSubmitted index)
- ]
- ]
- )
- (zip [1 ..] chats)
- )
+ HH.div_ $
+ fmap
+ ( \(index, (Chat chatMessages draft)) ->
+ HH.div_
+ [ HH.div_
+ ( fmap
+ ( \(Message message) ->
+ HH.text message
+ )
+ chatMessages
+ ),
+ HH.input
+ [ HP.value draft,
+ HE.onInputValueChange $ Just . (DraftChanged index),
+ HE.onClick (\_ -> DraftSubmitted index)
+ ]
+ ]
+ )
+ (zip [1 ..] chats)
handleQuery = \case
NoOpQ -> do
@@ -129,32 +128,28 @@ component =
NoOp -> do
get >>= H.raise
DraftChanged index draft -> do
- modify
- ( \chats ->
- fmap
- ( \(indexOther, chat) ->
- if indexOther == index
- then
- chat {draft = draft}
- else chat
- )
- (zip [1 ..] chats)
- )
+ modify $ \chats ->
+ fmap
+ ( \(indexOther, chat) ->
+ if indexOther == index
+ then
+ chat {draft = draft}
+ else chat
+ )
+ (zip [1 ..] chats)
get >>= H.raise
DraftSubmitted index -> do
- modify
- ( \chats ->
- fmap
- ( \(indexOther, chat) ->
- if indexOther == index
- then
- chat
- { chatMessages =
- chat.chatMessages
- ++ [Message chat.draft]
- }
- else chat
- )
- (zip [1 ..] chats)
- )
+ modify $ \chats ->
+ fmap
+ ( \(indexOther, chat) ->
+ if indexOther == index
+ then
+ chat
+ { chatMessages =
+ chat.chatMessages
+ ++ [Message chat.draft]
+ }
+ else chat
+ )
+ (zip [1 ..] chats)
get >>= H.raise