榆树签名在"Program Never Model Msg"中是什么意思? [英] what does the elm signature mean in "Program Never Model Msg"?

查看:53
本文介绍了榆树签名在"Program Never Model Msg"中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是开始使用Elm,并且不了解Haskell及其编译器我正在尝试掌握 Html.program

中的签名的含义

  func:(a->字符串)->字符串-这意味着需要一个函数并返回一个字符串main:程序Never Model Msg-这是什么意思? 

解决方案

Program 是由以下三个类型变量参数化的类型: flags model msg. 从不 是不能有任何值的类型(请参阅链接,以获取对它的含义以及与单位类型()的区别)的很好解释.

程序从不模型消息因此是没有任何标志(从不),模型类型为 Model

的程序的类型code>,并传递类型为 Msg 的消息.

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?

解决方案

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.

这篇关于榆树签名在"Program Never Model Msg"中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆