random-source 0.3 → 0.3.0.2
raw patch · 2 files changed
+17/−14 lines, 2 filesdep +th-extrasdep ~flexible-defaultsPVP ok
version bump matches the API change (PVP)
Dependencies added: th-extras
Dependency ranges changed: flexible-defaults
API changes (from Hackage documentation)
Files
- random-source.cabal +14/−7
- src/Data/Random/Internal/TH.hs +3/−7
random-source.cabal view
@@ -1,5 +1,5 @@ name: random-source-version: 0.3+version: 0.3.0.2 stability: provisional cabal-version: >= 1.6@@ -18,16 +18,22 @@ \"completing\" partial implementations, making it easy to define new entropy sources in a way that is naturally forward-compatible.+ .+ Changes in 0.3.0.2: Fixes for GHC 7.2.*'s crazy+ Template Haskell changes.+ .+ Changes in 0.3.0.1: None except setting dependency+ on flexible-defaults >= 0.0.0.2. -tested-with: GHC == 6.8.3, GHC == 6.10.4, GHC == 6.12.1, - GHC == 6.12.3, GHC == 7.0.1, GHC == 7.0.2+tested-with: GHC == 6.8.3, GHC == 6.10.4, GHC == 6.12.3,+ GHC == 7.0.4, GHC == 7.2.1, GHC == 7.2.2 source-repository head type: git location: https://github.com/mokus0/random-fu.git subdir: random-source -Flag splitBase+Flag base4 Description: base-4 and above do not include syb Flag mtl2@@ -63,16 +69,17 @@ else build-depends: mtl == 1.* - if flag(splitBase)+ if flag(base4) build-depends: base >= 4 && <5, syb else build-depends: base >= 3 && <4 - build-depends: flexible-defaults,+ build-depends: flexible-defaults >= 0.0.0.2, mersenne-random-pure64, random, stateref >= 0.3 && < 0.4,- template-haskell+ template-haskell,+ th-extras if os(Windows) cpp-options: -Dwindows
src/Data/Random/Internal/TH.hs view
@@ -10,6 +10,7 @@ import Data.Random.Internal.Source (Prim(..), MonadRandom(..), RandomSource(..)) import Data.Random.Internal.Words import Language.Haskell.TH+import Language.Haskell.TH.Extras import qualified Language.Haskell.TH.FlexibleDefaults as FD import Control.Monad.Reader@@ -105,9 +106,6 @@ noinline :: ReaderT Context (FD.Implementation s) () noinline = lift FD.noinline -replace :: (a -> Maybe a) -> (a -> a)-replace = ap fromMaybe- replaceMethodName :: (Method -> Name) -> Name -> Name replaceMethodName f = replace (fmap f . nameToMethod Generic) @@ -117,7 +115,8 @@ -- map all occurrences of generic method names to the proper local ones -- and introduce a 'src' parameter where needed if the Context is RandomSource specialize :: Monad m => Q [Dec] -> ReaderT Context m (Q [Dec])-specialize decQ = do+specialize futzedDecsQ = do+ let decQ = fmap genericalizeDecs futzedDecsQ c <- ask let specializeDec = everywhere (mkT (changeContext Generic c)) if c == RandomSource@@ -166,9 +165,6 @@ getWord64 = dummy GetWord64 getDouble = dummy GetDouble getNByteInteger = dummy GetNByteInteger--intIs64 :: Bool-intIs64 = toInteger (maxBound :: Int) > 2^32 -- The defaulting rules for RandomSource and MonadRandom. Costs are rates of -- entropy waste (bits discarded per bit requested) plus the occasional ad-hoc