Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Compiling with ghc7.7 #95

Closed
wants to merge 2 commits into from

2 participants

@schell

Compiles under ghc7.7.2013.11.06 :)

@mightybyte
Owner

The upgrade for GHC 7.8 was integrated in the course of some other work. Thanks for providing this as guidance.

@mightybyte mightybyte closed this
@schell

@mightybyte - of course, glad to help.
:+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
21 snap.cabal
@@ -123,13 +123,13 @@ Library
Snap.Snaplet.Test
other-modules:
- Control.Access.RoleBased.Checker
- Control.Access.RoleBased.Role
- Control.Access.RoleBased.Types
- Control.Access.RoleBased.Internal.Role
- Control.Access.RoleBased.Internal.RoleMap
- Control.Access.RoleBased.Internal.Rule
- Control.Access.RoleBased.Internal.Types
+ --Control.Access.RoleBased.Checker
+ --Control.Access.RoleBased.Role
+ --Control.Access.RoleBased.Types
+ --Control.Access.RoleBased.Internal.Role
+ --Control.Access.RoleBased.Internal.RoleMap
+ --Control.Access.RoleBased.Internal.Rule
+ --Control.Access.RoleBased.Internal.Types
Snap.Snaplet.Auth.AuthManager
Snap.Snaplet.Auth.Types
Snap.Snaplet.Auth.Handlers
@@ -185,7 +185,7 @@ Library
else
build-depends:
base >= 4.4 && < 5,
- lens >= 3.7.6 && < 3.11
+ lens >= 3.7.6 && <= 4.0.0
extensions:
BangPatterns,
@@ -231,11 +231,12 @@ Executable snap
hashable (>= 1.1 && < 1.2) || (>= 1.2.0.6 && <1.3),
old-time >= 1.0 && < 1.2,
snap-server >= 0.9 && < 0.11,
- template-haskell >= 2.2 && < 2.9,
+ template-haskell >= 2.2 && < 3.0,
text >= 0.11 && < 0.12
extensions:
- OverloadedStrings
+ OverloadedStrings,
+ TemplateHaskell
ghc-prof-options: -prof -auto-all
View
16 src/Snap/Snaplet/Config.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE CPP #-}
module Snap.Snaplet.Config where
@@ -14,7 +15,12 @@ import System.Console.GetOpt
------------------------------------------------------------------------------
-- | AppConfig contains the config options for command line arguments in
-- snaplet-based apps.
+#if MIN_VERSION_base(4,7,0)
newtype AppConfig = AppConfig { appEnvironment :: Maybe String }
+#else
+newtype AppConfig = AppConfig { appEnvironment :: Maybe String } deriving (Typeable)
+#endif
+
------------------------------------------------------------------------------
@@ -24,11 +30,17 @@ newtype AppConfig = AppConfig { appEnvironment :: Maybe String }
-- dynamic loader package can be updated so that manual Typeable instances
-- are no longer needed.
appConfigTyCon :: TyCon
+#if MIN_VERSION_base(4,7,0)
+appConfigTyCon = mkTyCon3 "snap" "Snap.Snaplet.Config" "AppConfig"
+#else
appConfigTyCon = mkTyCon "Snap.Snaplet.Config.AppConfig"
+#endif
{-# NOINLINE appConfigTyCon #-}
+#if !MIN_VERSION_base(4,7,0)
instance Typeable AppConfig where
typeOf _ = mkTyConApp appConfigTyCon []
+#endif
------------------------------------------------------------------------------
@@ -44,8 +56,8 @@ instance Monoid AppConfig where
------------------------------------------------------------------------------
-- | Command line options for snaplet applications.
appOpts :: AppConfig -> [OptDescr (Maybe (Config m AppConfig))]
-appOpts defaults = map (fmapOpt $ fmap (flip setOther mempty))
- [ Option ['e'] ["environment"]
+appOpts defaults = map (fmapOpt $ fmap (`setOther` mempty))
+ [ Option "e" ["environment"]
(ReqArg setter "ENVIRONMENT")
$ "runtime environment to use" ++ defaultC appEnvironment
]
View
4 src/Snap/Snaplet/Internal/Initializer.hs
@@ -256,7 +256,7 @@ mkSnaplet m = do
l <- getLens
let modifier = setInTop . set (cloneLens l . snapletValue)
return $ Snaplet cfg modifier res
-
+
------------------------------------------------------------------------------
@@ -657,5 +657,5 @@ getCfg :: FileName -> DirTree b -> [b]
getCfg cfg (Dir _ c) = map file $ filter (isCfg cfg) c
getCfg _ _ = []
-
+
View
10 src/Snap/Snaplet/Test.hs
@@ -15,7 +15,7 @@ import Control.Concurrent.MVar
import Control.Exception.Base (finally)
import qualified Control.Exception as E
import Control.Monad.IO.Class
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe)
import Data.IORef
import Data.Text
import System.Directory
@@ -52,7 +52,7 @@ removeFileMayNotExist f = catchNonExistence (removeFile f) ()
------------------------------------------------------------------------------
-- | Helper to keep "runHandler" and "evalHandler" DRY.
-execHandlerComputation :: MonadIO m
+execHandlerComputation :: MonadIO m
=> (RequestBuilder m () -> Snap v -> m a)
-> Maybe String
-> RequestBuilder m ()
@@ -99,7 +99,7 @@ runHandler = execHandlerComputation ST.runHandler
-- 'evalHandler defined in Snap.Test, because due to the fact running
-- the initializer inside 'SnapletInit' can throw an exception.
evalHandler :: MonadIO m
- => Maybe String
+ => Maybe String
-> RequestBuilder m ()
-> Handler b b a
-> SnapletInit b b
@@ -110,9 +110,9 @@ evalHandler = execHandlerComputation ST.evalHandler
------------------------------------------------------------------------------
-- | Run the given initializer, yielding a tuple where the first element is
-- a @Snaplet b@, or an error message whether the initializer threw an
--- exception.
+-- exception.
getSnaplet :: MonadIO m
- => Maybe String
+ => Maybe String
-> SnapletInit b b
-> m (Either Text (Snaplet b, InitializerState b))
getSnaplet env (SnapletInit initializer) = liftIO $ do
Something went wrong with that request. Please try again.