Skip to content

Commit

Permalink
Get building on nightly with ghc 8
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelXavier committed Feb 9, 2017
1 parent 6edd459 commit 399463f
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 37 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -47,8 +47,7 @@ matrix:
- hvr-ghc
packages:
- ghc-head
allow_failures:
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS=""
- env: GHCVER=head RESOLVER=nightly EXTRADEPS="" STACKARGS="--stack-yaml=stack_nightly.yaml"

before_install:
# Download and unpack the stack executable
Expand Down
Expand Up @@ -126,7 +126,7 @@ getApplicationDev = do
return (wsettings, app)

getAppSettings :: IO AppSettings
getAppSettings = loadAppSettings [configSettingsYml] [] useEnv
getAppSettings = loadYamlSettings [configSettingsYml] [] useEnv

-- | main function for use by yesod devel
develMain :: IO ()
Expand All @@ -136,7 +136,7 @@ develMain = develMainHelper getApplicationDev
appMain :: IO ()
appMain = do
-- Get the settings from all relevant sources
settings <- loadAppSettingsArgs
settings <- loadYamlSettingsArgs
-- fall back to compile-time values, set to [] to require values at runtime
[configSettingsYmlValue]

Expand Down
4 changes: 2 additions & 2 deletions examples/serversession-example-yesod-persistent/Foundation.hs
Expand Up @@ -6,7 +6,7 @@ import Text.Hamlet (hamletFile)
import Text.Jasmine (minifym)
import Web.ServerSession.Backend.Persistent
import Web.ServerSession.Frontend.Yesod
import Yesod.Auth.BrowserId (authBrowserId)
import Yesod.Auth.Dummy (authDummy)
import Yesod.Default.Util (addStaticContentExternal)
import Yesod.Core.Types (Logger)
import qualified Yesod.Core.Unsafe as Unsafe
Expand Down Expand Up @@ -140,7 +140,7 @@ instance YesodAuth App where
}

-- You can add other plugins like BrowserID, email or OAuth here
authPlugins _ = [authBrowserId def]
authPlugins _ = [authDummy]

authHttpManager = getHttpManager

Expand Down
Expand Up @@ -24,12 +24,12 @@ getHomeR = do
-- | Invalidate the session as requested via 'forceForm'.
postForceR :: Handler ()
postForceR =
processForm "Force form" forceForm $ \force -> do
processForm "Force form" forceForm $ \frce -> do
msid <- getSessionId
SS.forceInvalidate force
SS.forceInvalidate frce
return $ concat
[ "Forced session invalidation using "
, show force
, show frce
, " [old session ID was "
, show msid
, "]." ]
Expand Down
4 changes: 2 additions & 2 deletions examples/serversession-example-yesod-persistent/Settings.hs
Expand Up @@ -6,7 +6,7 @@
module Settings where

import ClassyPrelude.Yesod
import Control.Exception (throw)
import Control.Exception as E
import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?))
import Data.FileEmbed (embedFile)
Expand Down Expand Up @@ -108,7 +108,7 @@ configSettingsYmlBS = $(embedFile configSettingsYml)

-- | @config/settings.yml@, parsed to a @Value@.
configSettingsYmlValue :: Value
configSettingsYmlValue = either throw id $ decodeEither' configSettingsYmlBS
configSettingsYmlValue = either E.throw id $ decodeEither' configSettingsYmlBS

-- | A version of @AppSettings@ parsed at compile time from @config/settings.yml@.
compileTimeAppSettings :: AppSettings
Expand Down
Expand Up @@ -3,15 +3,15 @@ module Handler.CommonSpec (spec) where
import TestImport

spec :: Spec
spec = withApp $ do
describe "robots.txt" $ do
it "gives a 200" $ do
get RobotsR
statusIs 200
it "has correct User-agent" $ do
get RobotsR
bodyContains "User-agent: *"
describe "favicon.ico" $ do
it "gives a 200" $ do
get FaviconR
statusIs 200
spec = yesodSpecWithSiteGenerator mkApp $ do
ydescribe "robots.txt" $ do
yit "gives a 200" $ do
get RobotsR
statusIs 200
yit "has correct User-agent" $ do
get RobotsR
bodyContains "User-agent: *"
ydescribe "favicon.ico" $ do
yit "gives a 200" $ do
get FaviconR
statusIs 200
Expand Up @@ -3,7 +3,7 @@ module Handler.HomeSpec (spec) where
import TestImport

spec :: Spec
spec = withApp $ do
spec = yesodSpecWithSiteGenerator mkApp $ do
return ()
{-
it "loads the index and checks it looks right" $ do
Expand Down
Expand Up @@ -5,12 +5,12 @@ module TestImport

import Application (makeFoundation)
import ClassyPrelude as X
import Database.Persist as X hiding (get)
import Database.Persist as X hiding (delete, deleteBy, get)
import Database.Persist.Sql (SqlPersistM, SqlBackend, runSqlPersistMPool, rawExecute, rawSql, unSingle, connEscapeName)
import Foundation as X
import Foundation as X hiding (Handler)
import Model as X
import Test.Hspec as X
import Yesod.Default.Config2 (ignoreEnv, loadAppSettings)
import Yesod.Default.Config2 (ignoreEnv, loadYamlSettings)
import Yesod.Test as X

-- Wiping the database
Expand All @@ -25,9 +25,9 @@ runDB query = do
pool <- fmap appConnPool getTestYesod
liftIO $ runSqlPersistMPool query pool

withApp :: SpecWith App -> Spec
withApp = before $ do
settings <- loadAppSettings
mkApp :: IO App
mkApp = do
settings <- loadYamlSettings
["config/test-settings.yml", "config/settings.yml"]
[]
ignoreEnv
Expand All @@ -48,8 +48,8 @@ wipeDB app = do

-- Aside: SQLite by default *does not enable foreign key checks*
-- (disabling foreign keys is only necessary for those who specifically enable them).
let settings = appSettings app
sqliteConn <- rawConnection (sqlDatabase $ appDatabaseConf settings)
let settings = appSettings app
sqliteConn <- rawConnection (sqlDatabase $ appDatabaseConf settings)
disableForeignKeys sqliteConn

let logFunc = messageLoggerSource app (appLogger app)
Expand Down
Expand Up @@ -26,7 +26,7 @@ library
, bytestring
, cereal >= 0.4
, path-pieces
, persistent >= 2.1 && < 2.3
, persistent >= 2.1
, tagged >= 0.7
, text
, time
Expand Down Expand Up @@ -71,8 +71,8 @@ test-suite tests

, hspec >= 2.1 && < 3
, monad-logger
, persistent-sqlite >= 2.1 && < 2.3
, persistent-postgresql >= 2.1 && < 2.3
, persistent-sqlite >= 2.1
, persistent-postgresql >= 2.1
, resource-pool
, QuickCheck

Expand Down
4 changes: 2 additions & 2 deletions serversession-frontend-snap/serversession-frontend-snap.cabal
Expand Up @@ -25,8 +25,8 @@ library
, bytestring
, nonce
, path-pieces
, snap == 0.14.*
, snap-core == 0.9.*
, snap >= 0.14
, snap-core >= 0.9
, text
, time
, transformers
Expand Down
29 changes: 29 additions & 0 deletions stack_nightly.yaml
@@ -0,0 +1,29 @@
resolver: nightly-2017-02-02
packages:
- serversession
- serversession-backend-acid-state
- serversession-backend-persistent
- serversession-backend-redis
- serversession-frontend-snap
- serversession-frontend-wai
- serversession-frontend-yesod
- examples/serversession-example-yesod-persistent
flags:
serversession:
lib-Werror: true
serversession-backend-acid-state:
lib-Werror: true
serversession-backend-persistent:
lib-Werror: true
serversession-backend-redis:
lib-Werror: true
serversession-frontend-snap:
lib-Werror: true
serversession-frontend-wai:
lib-Werror: true
serversession-frontend-yesod:
lib-Werror: true
extra-deps:
- snap-1.0.0.1
- heist-1.0.1.0
- map-syntax-0.2.0.2

0 comments on commit 399463f

Please sign in to comment.