Skip to content

Instantly share code, notes, and snippets.

View dkaplan-pivotal's full-sized avatar

dkaplan-pivotal

View GitHub Profile
-- file: ch13/numsimple.hs
-- The "operators" that we're going to support
data Op = Plus | Minus | Mul | Div | Pow
deriving (Eq, Show)
{- The core symbolic manipulation type -}
data SymbolicManip a =
Number a -- Simple number, such as 5
| Arith Op (SymbolicManip a) (SymbolicManip a)
deriving (Eq, Show)
listResource :: [Text] -> ScottyM ()
listResource xs = get "/" $ do
html $ mconcat (["<h1>"] ++ [pack s] ++ ["</h1>"])
where
s = intercalate "</h1></h1>" . Prelude.map unpack $ xs
server.hs:18:40: error:
• Couldn't match type ‘[Char]’ with ‘Text’
Expected type: [Text] -> [Text]
Actual type: [Text] -> [String]
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Database.PostgreSQL.Simple
import Data.Monoid (mconcat)
import Data.Text.Lazy
main = do
connection <- getConnection
text <- getList connection
@dkaplan-pivotal
dkaplan-pivotal / load
Created May 9, 2017 17:12
Mac load SSH key script
#!/usr/bin/env bash
set -e
HOURS=$1
DIR=$(dirname $0)
KEY=$DIR/id_rsa
if [ -z $HOURS ]; then
HOURS=9