// by Dmitry Soshnikov | |
ES7: | |
== Lexical environment == | |
- Environment Record | |
- parent (can be null) | |
== Environment Record == |
/** If you want to know how to encoding HKTs in typescript, check this: | |
https://gist.github.com/ENvironmentSet/1662a140f99381bc85fd6be51ecdcbb5 | |
Sorry for messy names, this was only PoC. **/ | |
export interface HKT { | |
param: unknown; | |
result: unknown; | |
} |
// Sorry for poor naming, this example was intented to explain how to use skolem capturing in practise. | |
interface Stateful<S, A> { | |
(state: S): [A, S] | |
} | |
function fmap<S, A, B>(f: (a: A) => B): (stateful: Stateful<S, A>) => Stateful<S, B> { | |
return stateful => state => { | |
const [a, nextState] = stateful(state); |
export interface HKT { | |
param: unknown; | |
result: unknown; | |
} | |
interface NotHKT extends HKT { | |
result: this['param'] extends true ? false : true; | |
} | |
interface FstHKT extends HKT { |
# First, you must get the previous commit sha, the one before the forced push: | |
## Hit through terminal | |
curl -u <username> https://api.github.com/repos/:owner/:repo/events | |
# Then you can create a branch from this sha: | |
## Hit through terminal | |
curl -u <github-username> -X POST -d '{"ref":"refs/heads/<new-branch-name>", "sha":"<sha-from-step-1>"}' https://api.github.com/repos/:owner/:repo/git/refs |
이 문서가 여기저기 알려짐에 따라, 이곳에 여러가지 댓글이 달리고 있습니다. 개인적으로는 댓글창을 없애버리고 싶지만 그럴 수 없는 터라, 댓글을 달기 전에 한번씩만 더 생각해주셨으면 합니다.
- 개인적인 감상은 이곳이 아닌 다른 곳에 적어주세요.
- 동성애 혐오적인 댓글을 달지 마세요.
- 기타 "난해한 혀엉... 언어"와 관련없는 댓글을 달지 말아주세요.
위 사항들을 포함해 제 마음에 안 드는 댓글들은 임의로 삭제하고 있습니다. 양해 부탁드립니다.
{ | |
// http://eslint.org/docs/rules/ | |
"ecmaFeatures": { | |
"binaryLiterals": false, // enable binary literals | |
"blockBindings": false, // enable let and const (aka block bindings) | |
"defaultParams": false, // enable default function parameters | |
"forOf": false, // enable for-of loops | |
"generators": false, // enable generators | |
"objectLiteralComputedProperties": false, // enable computed object literal property names |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing