我正在使用elm-native-ui创建一个基本的本机聊天应用程序。
我可以通过单击更改聊天打开布尔值的按钮来打开或关闭聊天
activeChannelView =
case chatOpen of
True ->
Maybe.map (a -> chatView users a messages) activeChannel ? viewEmpty
False ->
Maybe.map (cardView users) activeChannel ? viewEmpty
在 False 方面,它运行良好,但在 True 方面,它说 viewEmpty 需要是一个(字符串 -> 节点消息(而不是 (Node Msg(,但左侧(聊天视图用户 a 消息(返回节点消息
检查下面的错误
The right side of (?) is causing a type mismatch.
Maybe.map (a -> chatView users a messages) activeChannel ? viewEmpty
^^^^^^^^^
(?) is expecting the right side to be a:
String -> Node Msg
But the right side is:
Node Msg
我想这意味着:如果 activeChannel 为 (Just a(,则 True 返回 (String -> Node Msg(
怎么可能出现此错误,因为聊天视图是这样定义的:
chatView : List User -> Request -> List String -> String -> Node Msg
chatView 需要四个参数,而您只传递了三个参数。