函數式編程的基本特徵之一就是 類型到類型之間的映射;html
(T item) => (Y item))express
(A, B, C) =>D編程
map(array<T> , (T item) => (Y item)) => array<Y>函數式編程
moand[array<T>>]map((T item) => (Y item)) => moand[array<Y>>]函數
1、非monad類型函數code
map(array<T> , (T item) => (Y item)) => array<Y>htm
函數所依賴的全部環境變量所有由參量傳入;blog
全部的環境變量(多個參數)打包成一個類型(準monad類型),做爲輸入類型,函數的輸出做爲輸出類型。ip
須要處理的主數據爲準monad類型的主類型;ci
monad化的含義就是將主類型用其它環境變量進行包裝,封裝成結構體的過程;
2、monad類型函數
map(array<T> , (T item) => (Y item)) => array<Y>
一、將環境變量中的數據類型信息打包正一個結構體;
二、主體函數和參量中的函數參量打包成高階函數;
將二者合併爲一個monand類型;
三、將高階函數的輸出提高爲monand;
As such, monads have been described as "programmable semicolons"; a semicolon is the operator used to chain together individual statements in many imperative programming languages,[2] thus the expression implies that extra code will be executed between the actions in the pipeline.
https://www.cnblogs.com/feng9exe/p/10510884.html
3、函數式編程本質上是對包含函數參量的函數的輸入、輸出進行類型變化的過程;
變換後的結果更容易進行組裝;
輸入類型—》輸出類型
多個輸入類型打包—moand化