Skip to content

Instantly share code, notes, and snippets.

data Country = US
deriving (Eq, Generic, Read, Show, Typeable)
instance ToJSON Country where
toEncoding = genericToEncoding $ defaultOptions {
constructorTagModifier = fmap toLower
}
instance FromJSON Country where
parseJSON = genericParseJSON $ defaultOptions {
@mrehayden1
mrehayden1 / gist:317ecc72f40d76a4a8e826db4fb0c274
Created December 7, 2018 14:33
Error when building a docker enabled stack project for the first time.
$ stack build
Error: No such object: fpco/stack-build:lts-12.17
Received ExitFailure 1 when running
Raw command: /usr/bin/docker inspect fpco/stack-build:lts-12.17
Standard output:
[]
@mrehayden1
mrehayden1 / Types.ts
Last active September 5, 2018 08:39
Discriminated Union
enum ItemType {
BunBottom,
BunTop,
Burger
}
type Cooked = [ number, number ]
type Item = {
type: ItemType.BunBottom
@mrehayden1
mrehayden1 / Touch.ts
Last active August 18, 2018 09:57
Mostjs Drag and Drop for touch devices.
import { Stream } from 'most';
import * as most from 'most';
type Maybe<T> = null | T
type Position = [number, number]
export function dragPositionStream(
touchStart$: Stream<TouchEvent>,
touchMove$: Stream<TouchEvent>,
touchEnd$: Stream<TouchEvent>