我需要一套独特的记录。但是Elm Core Set将set成员限制为comparable:
import Set exposing (Set)
mySet = Set.empty
Set.insert {name="Foo"} mySet
Run Code Online (Sandbox Code Playgroud)
-- TYPE MISMATCH ----------------------------------------------------------- elm
The 1st argument to `insert` is not what I expect:
6| Set.insert {name="Foo"} mySet
^^^^^^^^^^^^
This argument is a record of type:
{ name : String }
But `insert` needs the 1st argument to be:
comparable
Hint: Only ints, floats, chars, strings, lists, and tuples are comparable.
Run Code Online (Sandbox Code Playgroud)
您如何在榆树中制作一组记录?
我elm.json对elm/browser版本1.0.1 有依赖性。如何使用进行更新elm?
{
"dependencies": {
"direct": {
"elm/browser": "1.0.1",
...
Run Code Online (Sandbox Code Playgroud)
简单地手动更新它elm.json会使Elm抱怨:
-- INVALID PACKAGE DEPENDENCIES --------------------------------------- elm.json
The dependencies in your elm.json are not compatible.
Run Code Online (Sandbox Code Playgroud) 使用 Elm 的Html模块,输出的 html 标签之间没有任何空格。但对于内联显示的标签,空格有一个功能,可以使浏览器在它们之间显示空白。
div []
[ strong [] [ text "Key:" ]
, span [] [ text "value" ]
, text "(extra)"
]
Run Code Online (Sandbox Code Playgroud)
结果是:
<div><strong>Key:</strong><span>value</span>(extra)</div>
Run Code Online (Sandbox Code Playgroud)
在浏览器中显示为:Key:value(extra)
所需的 html 必须有某种空白:
<div>
<strong>Key:</strong>
<span>value</span>
(extra)
</div>
Run Code Online (Sandbox Code Playgroud)
在浏览器中显示为:键:值(额外)