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
#!/usr/bin/env stack | |
-- stack --resolver lts-6.5 --install-ghc runghc --package turtle --package parsec --package text --package either | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Monad.Trans.Either | |
import Data.Functor.Identity (Identity) | |
import Data.Monoid ((<>)) | |
import Data.Text (pack) | |
import Text.Parsec as P | |
import Turtle hiding (Parser) |
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 FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE OverlappingInstances #-} | |
module Main where | |
data Expr f = In (f (Expr f)) | |
foldExpr f (In t) = f (fmap (foldExpr f) t) |
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 FindPrimes where | |
import Data.List ((\\)) | |
setDifference = (\\) | |
primes = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 | |
, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 | |
, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113 | |
, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173 |
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 Main where | |
import Data.Aeson | |
import Data.Aeson.Types | |
import Control.Applicative (Alternative(..)) | |
data State = State { stateName :: String, stateNum :: Int } deriving (Eq, Show) | |
parseState :: Value -> Parser State | |
parseState = withObject "State" $ \v -> State <$> v .: "name" <*> v .: "id" |
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
exports.setHTML = function(el) { | |
return function (htmlElement) { | |
return function() { | |
el.innerHTML = ''; | |
el.appendChild(htmlElement); | |
}; | |
}; | |
}; |