Skip to content

Instantly share code, notes, and snippets.

Matt Parsons parsonsmatt

Block or report user

Report or block parsonsmatt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View animal2.sql
DROP DATABASE IF EXISTS animalsdb;
CREATE DATABASE animalsdb;
\c animalsdb;
-- We're modeling the following Haskell datatype:
--
-- data Animal = Cat Name Age | Dog Name OwnerId
--
-- We're going to factor the common 'Name' field into the animal table.
@andrewthad
andrewthad / hack_the_reader.hs
Created Nov 1, 2017
Benchmark queries in yesod
View hack_the_reader.hs
instance YesodPersist App where
type YesodPersistBackend App = SqlBackend
runDB action = do
master <- getYesod
runSqlPool (hackTheReader action) $ appConnPool master
newtype BenchmarkResults = BenchmarkResults [(Text,TimeSpec)]
deriving Typeable
type TypeMap = HashMap TypeRep Dynamic
@bishboria
bishboria / springer-free-maths-books.md
Last active Dec 13, 2019
Springer made a bunch of books available for free, these were the direct links
View Main.purs
module Main where
import Control.Monad.Eff (Eff)
import Data.Array (replicate, (!!), updateAt)
import Data.Maybe.Unsafe (fromJust)
import Data.Nullable (toMaybe)
import Prelude
import DOM (DOM)
import DOM.HTML (window)
View hash_compose.rb
# Since a key-value store is a finite, discrete function, and functions
# can be composed, then Hashes can be composed.
#
# The syntactic sugar for calling lambdas, accessing array values, and
# other objects which have a #[] method allow composition of Hashes
# with all sorts of objects and contexts with the same implementation.
#
# Play with it at https://eval.in/388458
#
class Hash
@queertypes
queertypes / FreeCoFree.hs
Created Jun 5, 2015
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
View FreeCoFree.hs
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.
@mankyKitty
mankyKitty / gist:10569173
Last active Aug 29, 2015
Trying to grok Functor for (a -> m b) type....thingy
View gist:10569173
-- Working through the Yorgey lectures on Applicatives for Haskell and trying to work out the homework...
-- A parser for a value of type a is a function which takes a String
-- represnting the input to be parsed, and succeeds or fails; if it
-- succeeds, it returns the parsed value along with the remainder of
-- the input.
newtype Parser a = Parser { runParser :: String -> Maybe (a, String) }
-- For example, 'satisfy' takes a predicate on Char, and constructs a
-- parser which succeeds only if it sees a Char that satisfies the
You can’t perform that action at this time.