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
-- 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 |
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 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. |
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
# 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 |
Everything was moved to https://github.com/rabbitonweb/papers_i_love
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
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 |
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
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. |