-
https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/
This means no running stack install ghc-mod or stack install intero either, no matter what READMEs might tell you!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Fluent<T extends object> = { | |
[K in keyof T]: (() => void) extends T[K] | |
? T[K] extends (...args: infer Params) => void | |
? (...args: Params) => Fluent<T> | |
: T[K] | |
: T[K]; | |
}; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function exhaustive(x: never): never { | |
throw new Error(` | |
Unreachable default case. | |
${x} is not assignable to type never. | |
`) | |
} | |
type Fruit = "apple" | "banana" | "mango"; | |
declare const fruit: Fruit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://svelte.dev/repl/65dc3ff369ea423f918e7ac3425b5677?version=3.6.9 | |
<script> | |
const pipe = (x, ...fs) => fs.reduce((v, f) => f(v), x); | |
const zip = xs => ys => xs.map((x, i) => [x, ys[i]]); | |
const head = xs => xs[0]; | |
const filter = predicate => xs => xs.filter(predicate); | |
const map = predicate => xs => xs.map(predicate); | |
const tap = proc => x => { | |
proc(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Products { | |
export type Car = { | |
name: 'Car'; | |
drive(): void; | |
} | |
export type IceCream = { | |
name: 'IceCream'; | |
flavor: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const questions = [ | |
{ | |
message: 'Enter your login (email address)...', | |
name: 'login', | |
type: 'input', | |
}, | |
{ | |
message: 'Enter your password...', | |
name: 'password', | |
type: 'password', |
- https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
- https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
- https://marketplace.visualstudio.com/items?itemName=2gua.rainbow-brackets ( or https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer )
- https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
- https://marketplace.visualstudio.com/items?itemName=jpoissonnier.vscode-styled-components
Vue:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Defined<T extends object> = { [K in keyof T]: Exclude<T[K], undefined> }; | |
type Assign<T1, T2> = { | |
[K in keyof T1 | keyof T2]: K extends keyof T2 | |
? T2[K] extends undefined | |
? K extends keyof T1 | |
? T1[K] | |
: never | |
: T2[K] | |
: K extends keyof T1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Constructor<T, Args extends any[]> = { | |
new (...args: Args): T; | |
(...args: Args): T; | |
}; | |
function makeConstructor<T, Args extends any[], P = {}>( | |
create: (...args: Args) => T, | |
prototype?: P & ThisType<T & P> | |
) { | |
const constructor = function(this: T | undefined, ...args: Args) { |