Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Oram tomphp

View GitHub Profile
View LightBulb.hs
module LightBulb
( LightBulb
, newLightBulb
, switchOn
, switchOff
) where
import Control.Concurrent (Chan, newChan, readChan, writeChan)
import Control.Concurrent.Async (async)
import Control.Monad.Loops (iterateM_)
View LogParser.elm
module LogParser exposing (..)
import Parser exposing (..)
type LogPart
= Text String
| URL String
View .ghcid
--command "stack ghci project:lib project:test:project-test --ghci-options='-fobject-code -Werror -Wall'" -T=main
View BowlingSpec.hs
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
module BowlingSpec where
import Test.Hspec
import Control.Applicative ((<|>))
newtype Frame = Frame Int deriving (Num, Enum)
@tomphp
tomphp / bowling.rs
Last active Oct 26, 2019
Rusty Bowling
View bowling.rs
const FRAMES_IN_GAME: i32 = 10;
const PINS_IN_FRAME: i32 = 10;
const ROLLS_IN_FRAME: usize = 2;
const ROLLS_IN_STRIKE_FRAME: usize = 1;
const ROLLS_IN_SCORE_DEFAULT: usize = 2;
const ROLLS_IN_SCORE_SPARE: usize = 3;
const ROLLS_IN_SCORE_STRIKE: usize = 3;
struct Game {
scores: Vec<i32>,
View Update.Elm
type LoadedContent a
= Loading
| Success a
| Failure
type alias Model
= LoadedContent Logs
@tomphp
tomphp / Main.hs
Created Jun 19, 2019
Code from Success & Failure Book
View Main.hs
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UnicodeSyntax #-}
module Main where
import Control.Lens
import Control.Monad ((>=>))
View Freer.hs
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
import Control.Monad ((>=>))
{-
-- Initial style
data Console a = GetLine String (String -> Console a)
@tomphp
tomphp / TennisSpec.hs
Created Apr 15, 2019
Incomplete tennis kata created with @JDurstberger at the LSCC coding dojo in the Moonpig office.
View TennisSpec.hs
module TennisSpec where
import Test.Hspec
data Point
= Love
| Fifteen
| Thirty
| Forty
deriving (Enum, Eq, Show)
View form.markdown

My Questionnaire

1. What's your name?


2. What's your favourite colour?

( ) Red ( ) Green