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
-- 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) |
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
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] |
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 OverloadedStrings #-} | |
import Web.Scotty | |
import Database.PostgreSQL.Simple | |
import Data.Monoid (mconcat) | |
import Data.Text.Lazy | |
main = do | |
connection <- getConnection | |
text <- getList connection |
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 bash | |
set -e | |
HOURS=$1 | |
DIR=$(dirname $0) | |
KEY=$DIR/id_rsa | |
if [ -z $HOURS ]; then | |
HOURS=9 |