小编Cha*_*lie的帖子

榆树:提交时的清晰表格

我有一个简单的表格,有一个字段.我想在表单提交上清除该字段.我正在更新函数中清除我的模型,但文本仍保留在文本输入中.

type alias Model =
    { currentSpelling : String }

type Msg
    = MorePlease

update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        MorePlease ->
            (  log "cleared spelling: " { model | currentSpelling = "" }
                , fetchWord model.currentSpelling )

view : Model -> Html Msg
view model =
    div []
        [ Html.form [ onSubmit MorePlease ]
            [ input [ type' "text"
                    , placeholder "Search for your word here"
                    , …
Run Code Online (Sandbox Code Playgroud)

elm

6
推荐指数
1
解决办法
1715
查看次数

我如何为有序/排序的数据结构寻求帮助?

我正在寻找需要其成员是 的实例的数据结构,Ord但在 Hackage 上找不到任何数据结构。我已经在Hoogle和Stackage 上搜索了表达式Ord a => [a] -> f a,因为我希望像fromList. 为什么我什么都没找到?

这是我想找到的函数/数据结构类型的示例。

sorting haskell data-structures

5
推荐指数
0
解决办法
55
查看次数

标签 统计

data-structures ×1

elm ×1

haskell ×1

sorting ×1