what does the elm signature mean in “Program Never Model Msg”?

拜拜、爱过 提交于 2021-02-10 14:05:03

问题


I'm just starting on elm and without understanding Haskell and its compiler I'm trying to grasp what the signature mean in Html.program

func: (a -> String) -> String -- this means expects a function and return a string
main: Program Never Model Msg -- What does this mean?

回答1:


Program is a type parameterized by three type variables: flags, model, and msg. Never is a type that cannot have any value (see the link for a good explanation of what this means and how it differs from the unit type ()).

Program Never Model Msg therefore is the type of a program that doesn't have any flags (Never), has a model of type Model, and passes messages of type Msg.



来源:https://stackoverflow.com/questions/47845714/what-does-the-elm-signature-mean-in-program-never-model-msg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!