From 0c01c9803a74fcfe16c3903bde373e5cb4e99f77 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 3 Mar 2025 16:40:33 +0100 Subject: `Message` -> `ChatMessage` --- app/Main.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index a58613e..bf6e635 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -66,19 +66,19 @@ forever $ do -} data Chat = Chat - { chatMessages :: [Message], + { chatMessages :: [ChatMessage], draft :: Text } deriving (Show) -data Message = Message Text +data ChatMessage = ChatMessage Text deriving (Show) testChats = [ Chat - [ Message "Hello", - Message "Hi", - Message "Hey" + [ ChatMessage "Hello", + ChatMessage "Hi", + ChatMessage "Hey" ] "" ] @@ -114,7 +114,7 @@ component = ( \(index, (Chat chatMessages draft)) -> HH.div_ [ HH.div_ - (fmap (\(Message message) -> HH.text message) chatMessages), + (fmap (\(ChatMessage message) -> HH.text message) chatMessages), HH.input [ HP.value draft, HE.onInputValueChange $ Just . (DraftChanged index), @@ -145,7 +145,10 @@ component = ( \(indexOther, chat) -> if indexOther == index then - chat {chatMessages = chat.chatMessages ++ [Message chat.draft]} + chat + { chatMessages = + chat.chatMessages ++ [ChatMessage chat.draft] + } else chat ) (zip [1 ..] chats) -- cgit v1.2.3