newtype WrappedApplicative f a = WrapApplicative (f a)
deriving
(Functor, Show)
deriving newtype
Applicative
instance (Applicative f, Num a) => Num (WrappedApplicative f a) where
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiWayIf, BangPatterns #-} | |
import Data.Word | |
import Data.Char | |
data Tape = Tape { negatives :: [Word8], currentTape :: !Word8, positives :: [Word8] } | |
mkTape = Tape (repeat 0) 0 (repeat 0) | |
shiftLeft (Tape (x:left) curr right) = Tape left x (curr:right) | |
shiftRight (Tape left curr (x:right)) = Tape (curr:left) x right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- My eyes! The goggles do nothing! | |
import Data.Char | |
import Data.List | |
import Data.Maybe | |
import qualified Data.Map.Strict as Dm | |
type Symbol = Char | |
type Alphabet = [Symbol] | |
type State = String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns lies.core | |
(:use arcadia.core | |
lies.messages) | |
(:require arcadia.messages | |
[clojure.edn :as edn])) | |
(defn- type? [t] | |
(isa? (type t) Type)) | |
(defn- type-map [m] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using Parsec to score a bowling game. | |
=== | |
In this gist we'll see how to use Parsec to solve the problem of | |
scoring a bowling game. This was inspired by a | |
Reddit Daily Programmer problem: | |
https://www.reddit.com/r/dailyprogrammer/comments/3ntsni/20151007_challenge_235_intermediate_scoring_a/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Liars where | |
import Control.Monad | |
import Data.List | |
data Person = Truthteller | Liar deriving (Show, Eq) | |
says :: Person -> Bool -> Bool | |
says Truthteller = id | |
says Liar = not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE Rank2Types #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pauseTime = 0.35 | |
timePerThrow = 300 | |
handMovement = 0.2 | |
pattern = [5] | |
rotatePattern : Int -> [a] -> [a] | |
rotatePattern n xs = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UTC20160530 | |
LambdaConf 2016 Unconference Schedule (Tentative) | |
A115 | |
1:00 - 3:00 PM | |
Engineering a Better Twitter panel | |
3:00 - 3:30 PM | |
0 - Becoming a LambdaConf Speaker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data MyState s a = MyState (s -> (a, s)) | |
get :: MyState s s | |
get = undefined | |
put :: s -> MyState s () | |
put = undefined | |
modify :: (s -> s) -> MyState s () | |
modify = undefined |
OlderNewer