Skip to content

Instantly share code, notes, and snippets.

View wclr's full-sized avatar
🔥
Fighting the SUN

Alex wclr

🔥
Fighting the SUN
  • Need a light, hah?
  • Upper Worlds
View GitHub Profile
@wclr
wclr / generic-deriving.purs
Created April 19, 2021 15:54 — forked from dlants/generic-deriving.purs
Generic deriving with purescript
-- 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)
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 December 7, 2017 18:34 — forked from jcalz/tuple.md
TypeScript tuple inference

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 December 7, 2017 18:34 — forked from jcalz/tuple.md
TypeScript tuple inference

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 April 6, 2018 15:06
A way to handle state in cycle.js

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
@wclr
wclr / esnextbin.md
Created October 1, 2016 09:19
esnextbin sketch
@wclr
wclr / esnextbin.md
Last active October 1, 2016 10:23
esnextbin sketch
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'
Recycling
and
speed
limits
are
bullshit
Tyler
said
They’re
like