aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs17
1 files 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)