Skip to content

Instantly share code, notes, and snippets.

Matt Parsons parsonsmatt

View GitHub Profile
View animal2.sql
\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 / 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 /
Last active Jul 10, 2020
Springer made a bunch of books available for free, these were the direct links
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
class Hash
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 / 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.