From f9eff0b21ad4c79f0bde39bd2e8bd35bd9009c96 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 3 Mar 2025 16:38:37 +0100 Subject: drop some braces --- app/Main.hs | 87 +++++++++++++++++++++++++++++-------------------------------- 1 file 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 -- cgit v1.2.3