snap 1.1.0.0 → 1.1.1.0
raw patch · 5 files changed
+66/−24 lines, 5 filesdep +semigroupsdep ~QuickCheckdep ~aesondep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: semigroups
Dependency ranges changed: QuickCheck, aeson, base, containers, heist, lens, map-syntax, mwc-random, snap-server, stm, time
API changes (from Hackage documentation)
+ Snap.Snaplet.Config: instance Data.Semigroup.Semigroup Snap.Snaplet.Config.AppConfig
- Snap.Snaplet: snapletConfig :: forall s_au2W. Lens' (Snaplet s_au2W) SnapletConfig
+ Snap.Snaplet: snapletConfig :: forall s_avRm. Lens' (Snaplet s_avRm) SnapletConfig
- Snap.Snaplet: snapletValue :: forall s_au2W. Lens' (Snaplet s_au2W) s_au2W
+ Snap.Snaplet: snapletValue :: forall s_avRm. Lens' (Snaplet s_avRm) s_avRm
Files
- snap.cabal +25/−12
- src/Snap/Snaplet/Config.hs +15/−5
- src/Snap/Snaplet/Internal/Initializer.hs +1/−1
- src/Snap/Snaplet/Internal/Types.hs +14/−5
- test/suite/Snap/Snaplet/Config/Tests.hs +11/−1
snap.cabal view
@@ -1,5 +1,5 @@ name: snap-version: 1.1.0.0+version: 1.1.1.0 synopsis: Top-level package for the Snap Web Framework description: This is the top-level package for the official Snap Framework libraries.@@ -33,9 +33,16 @@ homepage: http://snapframework.com/ bug-reports: https://github.com/snapframework/snap/issues category: Web, Snap-Tested-With: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3,- GHC == 8.0.1, GHC == 8.2.1 +Tested-With:+ GHC == 7.4.2,+ GHC == 7.6.3,+ GHC == 7.8.4,+ GHC == 7.10.3,+ GHC == 8.0.1,+ GHC == 8.2.1,+ GHC == 8.4.1+ extra-source-files: .ghci CONTRIBUTORS,@@ -103,9 +110,9 @@ Snap.Snaplet.Session.SecureCookie build-depends:- aeson >= 0.6 && < 1.3,+ aeson >= 0.6 && < 1.4, attoparsec >= 0.10 && < 0.14,- base >= 4 && < 4.11,+ base >= 4 && < 4.12, bytestring >= 0.9.1 && < 0.11, cereal >= 0.3 && < 0.6, clientsession >= 0.8 && < 0.10,@@ -119,24 +126,27 @@ -- snap does work with hashable 1.1.*, but some have complained that -- the version disjunction causes problems with dependency resolution. hashable >= 1.2.0.6 && < 1.3,- heist >= 1.0 && < 1.1,- lens >= 3.7.6 && < 4.16,+ heist >= 1.1 && < 1.2,+ lens >= 3.7.6 && < 4.17, lifted-base >= 0.2 && < 0.3,- map-syntax >= 0.2 && < 0.3,+ map-syntax >= 0.2 && < 0.4, monad-control >= 0.3 && < 1.1, mtl >= 2.0 && < 2.3, mwc-random >= 0.8 && < 0.14, pwstore-fast >= 2.2 && < 2.5, snap-core >= 1.0 && < 1.1,- snap-server >= 1.0 && < 1.1,+ snap-server >= 1.0 && < 1.2, stm >= 2.2 && < 2.5, text >= 0.11 && < 1.3,- time >= 1.1 && < 1.9,+ time >= 1.1 && < 1.10, transformers >= 0.2 && < 0.6, transformers-base >= 0.4 && < 0.5, unordered-containers >= 0.1.4 && < 0.3, xmlhtml >= 0.1 && < 0.3 + if !impl(ghc >= 8.0)+ build-depends: semigroups >= 0.16 && < 0.19+ extensions: BangPatterns, CPP,@@ -220,7 +230,7 @@ build-depends: aeson,- async >= 2.0.1.5 && < 2.2,+ async >= 2.0.1.5 && < 2.3, attoparsec, base, bytestring,@@ -244,7 +254,7 @@ mtl, mwc-random, pwstore-fast,- QuickCheck >= 2.4.2 && < 2.11,+ QuickCheck >= 2.4.2 && < 2.12, smallcheck >= 1.1.1 && < 1.2, snap-core, snap-server,@@ -261,6 +271,9 @@ transformers-base, unordered-containers, xmlhtml++ if !impl(ghc >= 8.0)+ build-depends: semigroups extensions: BangPatterns,
src/Snap/Snaplet/Config.hs view
@@ -22,6 +22,10 @@ import Data.Monoid (Monoid, mappend, mempty) #endif +#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup (Semigroup(..))+#endif+ import System.Console.GetOpt (OptDescr(Option), ArgDescr(ReqArg)) ------------------------------------------------------------------------------ import Snap.Core@@ -51,14 +55,20 @@ typeOf _ = mkTyConApp appConfigTyCon [] #endif --------------------------------------------------------------------------------instance Monoid AppConfig where- mempty = AppConfig Nothing- mappend a b = AppConfig+instance Semigroup AppConfig where+ a <> b = AppConfig { appEnvironment = ov appEnvironment a b } where- ov f x y = getLast $! (mappend `on` (Last . f)) x y+ ov f x y = getLast $! ((<>) `on` (Last . f)) x y+++------------------------------------------------------------------------------+instance Monoid AppConfig where+ mempty = AppConfig Nothing+#if !MIN_VERSION_base(4,11,0)+ mappend = (<>)+#endif ------------------------------------------------------------------------------
src/Snap/Snaplet/Internal/Initializer.hs view
@@ -517,7 +517,7 @@ --------------------------------------------------------------------------------- | Lets you change a snaplet's initial state. It's alomst like a reload,+-- | Lets you change a snaplet's initial state. It's almost like a reload, -- except that it doesn't run the initializer. It just modifies the result of -- the initializer. This can be used to let you define actions for reloading -- individual snaplets.
src/Snap/Snaplet/Internal/Types.hs view
@@ -38,6 +38,10 @@ import Data.Monoid (Monoid (mappend, mempty)) #endif +#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup (Semigroup(..))+#endif+ ------------------------------------------------------------------------------ @@ -467,11 +471,8 @@ -- initialization. newtype Hook a = Hook (Snaplet a -> IO (Either Text (Snaplet a))) ---------------------------------------------------------------------------------instance Monoid (Hook a) where- mempty = Hook (return . Right)- (Hook a) `mappend` (Hook b) = Hook $ \s -> do+instance Semigroup (Hook a) where+ Hook a <> Hook b = Hook $ \s -> do ea <- a s case ea of Left e -> return $ Left e@@ -480,6 +481,14 @@ case eb of Left e -> return $ Left e Right bres -> return $ Right bres+++------------------------------------------------------------------------------+instance Monoid (Hook a) where+ mempty = Hook (return . Right)+#if !MIN_VERSION_base(4,11,0)+ mappend = (<>)+#endif ------------------------------------------------------------------------------
test/suite/Snap/Snaplet/Config/Tests.hs view
@@ -8,7 +8,12 @@ import qualified Data.Configurator.Types as C import Data.Function import qualified Data.Map as Map+#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup+import Data.Monoid hiding ((<>))+#else import Data.Monoid+#endif import Data.Typeable import System.Environment ------------------------------------------------------------------------------@@ -50,9 +55,14 @@ instance Arbitrary ArbAppConfig where arbitrary = liftM (ArbAppConfig . AppConfig) arbitrary +instance Semigroup ArbAppConfig where+ a <> b = ArbAppConfig $ ((<>) `on` unArbAppConfig) a b+ instance Monoid ArbAppConfig where mempty = ArbAppConfig mempty- a `mappend` b = ArbAppConfig $ ((<>) `on` unArbAppConfig) a b+#if !MIN_VERSION_base(4,11,0)+ mappend = (<>)+#endif monoidLeftIdentity :: ArbAppConfig -> Bool monoidLeftIdentity a = mempty <> a == a