dynamic-state 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+6/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
dynamic-state.cabal view
@@ -1,5 +1,5 @@ name: dynamic-state-version: 0.1.0.3+version: 0.1.0.4 synopsis: Optionally serializable dynamic state keyed by type description: Optionally serializable dynamic state keyed by type license: GPL-2
src/Data/DynamicState/Serializable.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_HADDOCK show-extensions #-} -- |@@ -41,8 +42,11 @@ -- | Try to extract a value from the 'Dynamic', returning True if it was decoded from a 'Serial' fromDynamic :: forall a. (Typeable a, Binary a) => Dynamic -> Maybe (a,Bool) fromDynamic (Dynamic b) = (,False) <$> cast b+#if __GLASGOW_HASKELL__ < 708+fromDynamic (Serial bs) = (Just $ decode bs,True)+#else fromDynamic (Serial bs) = let b = either (const Nothing) (\(_,_,a) -> Just a) $ decodeOrFail bs in (,True) <$> b-+#endif instance Binary Dynamic where put = put . toSerialRep where