问题
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