- domain/codomain
- deterministic
def blah1() = if(false) throw new Exception else 2
def blah2() = {
val a = throw new Exception
if(false) a else 2
// Note, this is a (very) quick POC, this is far from perfect and needs improvement. But it works | |
import { pipe, identity } from "@effect/data/Function" | |
import * as T from "@effect/io/Effect" | |
import { TaggedClass } from "@effect/data/Data" | |
import * as Match from "@effect/match" | |
export class Given<R, S, A> extends TaggedClass("Given")<{ | |
fa: T.Effect<R, any, S> | |
_A: (a: never) => A |
import { Tagged } from "@effect-ts/core/Case" | |
import * as P from "../../prelude" | |
import * as Free from "./FreeMonad" | |
import { makeFree } from "./FreeMonad" | |
import { identity, pipe } from "@effect-ts/core/Function" | |
import * as T from "@effect-ts/core/Effect" | |
import { matchTag } from "@effect-ts/core/Utils" | |
import * as FS from "fs" | |
import * as Ei from "@effect-ts/core/Either" |
class ExpectedError<E> { | |
readonly _tag = 'ExpectedError'; | |
constructor(public readonly error: E) {} | |
} | |
class Die { | |
readonly _tag = 'Die'; | |
constructor(public readonly reason: string, public readonly data: any) {} | |
} |
describe(`Queue`, () => { | |
describe(`isEmpty`, () => { | |
test(`Empty queue returns true`, async () => { | |
const queue = new InMemoryQueue<string>(); | |
const result = await queue.isEmpty(); | |
expect(result).toEqual(true); | |
}); |
type MatchTag = { | |
// Strict match, one handler must be provided for each possible tag | |
< | |
X extends { _tag: string }, | |
K extends { | |
[k in X['_tag']]: (member: Extract<X, { _tag: k }>) => any | |
}, | |
>( | |
handlers: K, | |
): (member: X) => ReturnType<K[keyof K]> |
ps -ax # List all running processes | |
ps -ax | grep {X} # Get all processes with name {X} Ex: ps -ax | grep Skype | |
kill {pid} # Kill a running process. Ex: kill 44345 | |
# Kill a port | |
kill -2 $(lsof -t -i:4200) # https://stackoverflow.com/questions/39091735/port-4200-is-already-in-use-when-running-the-ng-serve-command |
import { Yolo } from "./yolo" | |
import { Loggable } from "./loggable" | |
// Nothing in this object ? Don't care, yolo | |
const x = Yolo<any>().whatever.i.wont.fail.lolz().im.batman() | |
// I know it's boring but If the value exist you can still access it ;) | |
const Y = Yolo<any>( { hello: { name: "world" } } ).hello.name // -> "world" | |
// Also, yay typescript |
yarn add testdouble @testing-library/react jest-dom testdouble-jest jest-then enzyme enzyme-adapter-react-16 @types/enzyme @types/enzyme-adapter-react-16 -D |
https://stackoverflow.com/questions/45372227/how-to-implement-typescript-deep-partial-mapped-type-not-breaking-array-properti/49936686#49936686 | |
export type DeepPartial<T> = { | |
[P in keyof T]?: T[P] extends Array<infer U> | |
? Array<DeepPartial<U>> | |
: T[P] extends ReadonlyArray<infer U> | |
? ReadonlyArray<DeepPartial<U>> | |
: DeepPartial<T[P]> | |
}; | |