博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Monad (functional programming)
阅读量:6256 次
发布时间:2019-06-22

本文共 1563 字,大约阅读时间需要 5 分钟。

In , a monad is a  that defines how functions, actions, inputs, and outputs can be used together to build , with the following organization:

  1. Define a data type, and how values of that data type are combined.
  2. Create functions that use the data type, and compose them together into actions, following the rules defined in the first step.

A monad may  values of a particular , creating a new type associated with a specific additional , typically to handle special cases of the type. For example, the simple Maybe monad encapsulates  which may have a , representing an , and automatically ensures that null values are not passed as arguments to functions that cannot handle them, serving as an alternative programming technique to throwing and catching  when null values arise. Another example is the , where the empty list is a constant value of type List, and the  operator binds a plain value as the head of a previous list.

The monad represents computations with a sequential structure: a monad defines what it means to chain operations together. This enables the programmer to build  that process data in a series of steps (i.e. a series of actions applied to the data), in which each action is  with the additional processing rules provided by the monad. A monad is defined by a return  that creates values, and a bind operator used to link the actions in the pipeline; this definition must follow a set of  called monad laws, which are needed for the composition of actions in the pipeline to work properly.

 

https://en.wikipedia.org/wiki/Monad_(functional_programming)

转载地址:http://tunsa.baihongyu.com/

你可能感兴趣的文章
20180725笔记
查看>>
“微信封杀”互联网公司躲不过的“坎儿”
查看>>
必应(Bing)搜索被屏蔽的原因是什么?
查看>>
热衷混合云,近半数金融机构还在用传统数据中心
查看>>
Ei期刊投稿要求
查看>>
Teradata 时间类型转换
查看>>
AngularJS指令中compile与link的区别
查看>>
如何在普尔文网站注册华为认证考试以及参加考试
查看>>
DirectX 32位显示模式简单控制 Demo 中
查看>>
使用httpclient必须知道的参数设置及代码写法、存在的风险
查看>>
iOS设计模式-适配器
查看>>
Coreseek + Sphinx + Mysql + PHP构建中文检索引擎
查看>>
SQL server 实现自动异地备份
查看>>
Migrate Instance 操作详解 - 每天5分钟玩转 OpenStack(40)
查看>>
【MySql】9.触发器
查看>>
Laravel ES搜索
查看>>
ASA防火墙3 基本路由
查看>>
C++ Non-Public Inheritance
查看>>
API接口测试中需要测试的几个方面
查看>>
分治策略
查看>>