11. “A developer should be able to continue to
productively write code as their application
grows and more team members join.”
“The key to achieving this is applying
Haskell's type-safety to an otherwise
traditional MVC REST web framework.”
http://www.yesodweb.com/page/about
14. {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
instance Yesod HelloWorld
getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]
main :: IO ()
main = warp 3000 HelloWorld
routing
handler
starting a web server
23. data Test = Test
instance Yesod Test
instance YesodJquery Test
instance YesodTransloadit Test
— or
instance YesodTransloadit Test where
transloaditRoot _ = “https://my_cdn.com/“
25. share [mkPersist sqlSettings,
mkMigrate “migrateAll”]
[persistLowerCase|
Person
name String
age Int Maybe
deriving Show
BlogPost
title String
authorId PersonId
deriving Show
|]
26. johnId <- insert $ Person "John Doe" $ Just 35
oneJohnPost <- selectList
[BlogPostAuthorId ==. johnId]
[LimitTo 1]
27. esqueleto
“esqueleto is a bare bones, type-safe EDSL for SQL queries
that works with unmodified persistent SQL backends”
https://hackage.haskell.org/package/esqueleto
28. E.selectSource $ E.from $
(blog `E.InnerJoin` author) -> do
E.on $ blog ^. BlogAuthor E.==. author ^. AuthorId
return
( blog ^. BlogId
, blog ^. BlogTitle
, author ^. AuthorName
)
34. 1. Pre-bake an AMI with a Nix environment
2. Build a new AMI per app version with Nix
3. Associate new instances with the ASG
http://bobjflong.co/posts/2015-08-22-yesod.html