{-# START_FILE .dir-locals.el #-}
((haskell-mode . ((haskell-indent-spaces . 4)
                  (haskell-process-use-ghci . t)))
 (hamlet-mode . ((hamlet/basic-offset . 4)
                 (haskell-process-use-ghci . t))))

{-# START_FILE .ghci #-}
:set -i.:config:dist/build/autogen
:set -DDEVELOPMENT
:set -XCPP -XTemplateHaskell -XQuasiQuotes -XTypeFamilies -XFlexibleContexts -XGADTs -XOverloadedStrings -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving -XEmptyDataDecls -XDeriveDataTypeable

{-# START_FILE .gitignore #-}
dist*
static/tmp/
static/combined/
config/client_session_key.aes
*.hi
*.o
*.sqlite3
.hsenv*
cabal-dev/
yesod-devel/
.cabal-sandbox
cabal.sandbox.config
.DS_Store
*.swp

{-# START_FILE Add.hs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes       #-}
module Add where

import Foundation
import Yesod

getAddR :: Int -> Int -> Handler TypedContent
getAddR x y = selectRep $ do
    provideRep $ defaultLayout $ do
        setTitle "Addition"
        [whamlet|#{x} + #{y} = #{z}|]
    provideJson $ object ["result" .= z]
  where
    z = x + y

{-# START_FILE Application.hs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}
{-# LANGUAGE ViewPatterns      #-}
module Application where

import Foundation
import Yesod

import Add
import Home

mkYesodDispatch "App" resourcesApp

{-# START_FILE Foundation.hs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}
{-# LANGUAGE TypeFamilies      #-}
{-# LANGUAGE ViewPatterns      #-}
module Foundation where

import Yesod

data App = App

mkYesodData "App" $(parseRoutesFile "routes")

instance Yesod App

{-# START_FILE Home.hs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes       #-}
module Home where

import Foundation
import Yesod

getHomeR :: Handler Html
getHomeR = defaultLayout $ do
    setTitle "Minimal Multifile"
    [whamlet|
        <p>
            <a href=@{AddR 5 7}>HTML addition
        <p>
            <a href=@{AddR 5 7}?_accept=application/json>JSON addition
    |]

{-# START_FILE Main.hs #-}
import Application () -- for YesodDispatch instance
import Foundation
import Yesod

main :: IO ()
main = warp 3000 App

{-# START_FILE PROJECTNAME.cabal #-}
name:               PROJECTNAME
version:            0.0.0
cabal-version:      >= 1.8
build-type:         Simple
extra-source-files: routes

executable          PROJECTNAME
  main-is:          Main.hs
  other-modules:    Application
                    Foundation

                    Add
                    Home

  ghc-options:      -Wall -fwarn-tabs -O2

  build-depends:  base
                , yesod

  ghc-options:    -threaded -O2 -rtsopts -with-rtsopts=-N

{-# START_FILE routes #-}
/              HomeR GET
/add/#Int/#Int AddR  GET

