我现在正在阅读fp的足够指南。但我无法弄清楚如何正确地编写这个函数。
const R = require('ramda');
const {IO, Future} = require('ramda-fantasy');
const read = () => IO(() => 'hello');
const write = (data) => IO(() => {
console.log(data)
return data;
});
const process = (data) => Future((reject, resolve) => {
return setTimeout(() => resolve(data), 0);
});
组合功能的最佳方法是:read - >过程 - >写?
答案 0 :(得分:0)
将ios更改为期货。
.nav li {
list-style: none;
position:relative;
}
.subnav-block {
position: absolute;
width: 100% !important;
top: 54px;
left: 0;
padding: 20px 0 !important;
height: 140px;
background: gray;
opacity:0;
visibillity:hidden;
-webkit-transition: all 0.6s ease-in-out 0.15s;
-moz-transition: all 0.6s ease-in-out 0.15s;
-o-transition: all 0.6s ease-in-out 0.15s;
-ms-transition: all 0.6s ease-in-out 0.15s;
transition: all 0.6s ease-in-out 0.15s;
}
.nav > li:hover .subnav-block{
opacity:1;
visibilty:visiable;
}
未来就像异步ios,因此在两种类型之间提升之间没有多大意义。如果您真的想区别对待它们,可以按照bergi的建议将monad嵌套到IO>中。