Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Fighting the SUN

Alex wclr

🔥
Fighting the SUN
  • Need a light, hah?
  • Upper Worlds
View GitHub Profile
@wclr
wclr / generic-deriving.purs
Created Apr 19, 2021 — forked from dlants/generic-deriving.purs
Generic deriving with purescript
View generic-deriving.purs
-- an example of how to derive a show instance for a Maybe type
-- not totally sure why `derive instance showMyMaybe :: (Show a) => Show (MyMaybe a)` errors with...
-- error: CannotDerive :
-- Cannot derive a type class instance for Data.Show.Show (MyMaybe a) since instances of this type class are not derivable.
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
View add-circular.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wclr
wclr / tuple.md
Created Dec 7, 2017 — forked from jcalz/tuple.md
TypeScript tuple inference
View tuple.md

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@wclr
wclr / tuple.md
Created Dec 7, 2017 — forked from jcalz/tuple.md
TypeScript tuple inference
View tuple.md

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@wclr
wclr / cycle-state-ramda.md
Last active Apr 6, 2018
A way to handle state in cycle.js
View cycle-state-ramda.md

A way to handle state in cycle.js

Simple state management with xstream and ramda, in more transparent fashion than onionify

import * as R from 'ramda'

// first we create factory for making special state stream 
// that will hold our stream value and will be modified with supplied streams of reducers
type StateReducer<T> = (state: T) => T
View TaskManager.ts
import * as vscode from 'vscode'
import { CommandsSource, CommandsRequest } from '../drivers/commands'
import { WindowRequest, WindowSource } from '../drivers/window'
import { ParserResponse, ParsedTask } from '../drivers/parser'
import { WorkspaceRequest, WorkSpaceSource } from '../drivers/workspace'
import { TerminalCommand, terminalCommands, TerminalSource } from '../drivers/terminal'
import { Stream, MemoryStream, default as xs } from 'xstream'
import delay from 'xstream/extra/delay'
import flattenConcurrently from 'xstream/extra/flattenConcurrently'
View FC - Chapter 13-4 transcript.txt
Recycling
and
speed
limits
are
bullshit
Tyler
said
They’re
like