我一直在閱讀過Richard Feldman's Elm SPA app example,和我看到這樣的一些東西examples: type Username
= Username String
和我當它有意義的使用類似的東西不知道,一個單值聯合類型,與只是一個類型別名是這樣的: type alias Username
= String
什麼時候適合只使用一個單值工會與
type Msg
= NoOp
| RequestDate
| ReceiveDate Date
| UpdateYouTubeUrl YouTubeUrl
-- -
root : Maybe YouTubeUrl -> Html Msg
root youTubeUrl =
case youTubeUrl of
Just yo
我有一個下面的一段代碼榆樹(省略了用於brievity getProjectView功能)的類型: type Model = Maybe List Project
model : Model
model = Nothing
getView : Model -> Html any
getView model =
case model of
Just projects
我從F#的背景來了,我想「缺點」的項目上像這樣的列表... 直接在REPL .. 。 model = {things = []}
morethings = model.things :: "anything"
但是編譯器說這個.. (::) is expecting the right side to be a:
List (List String)
But the righ
我全新的榆樹和我掙扎,看看這裏有什麼問題.. view : Model -> Html Msg
view model = div [] [ button [ onClick NewStrategy ] [ text "-" ] ]
抱怨.. The type annotation for `view` says it always returns:
Html (Msg)
Bu
如何更新列表中的項目? 我試過如下: setFeaturedLink links link =
let
dictionary =
Dict.fromList links
result =
Dict.filter (\k v -> v.title == link.title) dictionary |> Dict.toList |> L