我有一个简单的表格,有一个字段.我想在表单提交上清除该字段.我正在更新函数中清除我的模型,但文本仍保留在文本输入中.
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) 我正在寻找需要其成员是 的实例的数据结构,Ord但在 Hackage 上找不到任何数据结构。我已经在Hoogle和Stackage 上搜索了表达式Ord a => [a] -> f a,因为我希望像fromList. 为什么我什么都没找到?
这是我想找到的函数/数据结构类型的示例。