haxl 2.0.0.0 → 2.0.1.0
raw patch · 5 files changed
+41/−9 lines, 5 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
+ Haxl.Core: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> k -> GenHaxl u a -> GenHaxl u a
+ Haxl.Core.Memo: data MemoVar u a
+ Haxl.Core.Memo: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> k -> GenHaxl u a -> GenHaxl u a
Files
- Haxl/Core.hs +1/−1
- Haxl/Core/Memo.hs +26/−2
- changelog.md +7/−0
- haxl.cabal +3/−3
- readme.md +4/−3
Haxl/Core.hs view
@@ -31,7 +31,7 @@ -- ** Memoization , newMemo, newMemoWith, prepareMemo, runMemo- , memo, memoize, memoize1, memoize2+ , memo, memoUnique, memoize, memoize1, memoize2 , memoFingerprint, MemoFingerprintKey(..) -- ** Conditionals
Haxl/Core/Memo.hs view
@@ -30,8 +30,10 @@ , memoFingerprint , MemoFingerprintKey(..) , memoize, memoize1, memoize2+ , memoUnique -- * Local memoization+ , MemoVar , newMemo , newMemoWith , prepareMemo@@ -302,12 +304,24 @@ => k -> GenHaxl u a -> GenHaxl u a memo key = cachedComputation (MemoKey key) -{-# RULES "memo/Text"- memo = memoText :: (Typeable a) => Text -> GenHaxl u a -> GenHaxl u a+{-# RULES+"memo/Text" memo = memoText :: (Typeable a) =>+ Text -> GenHaxl u a -> GenHaxl u a+"memoUnique/Text" memoUnique = memoUniqueText :: (Typeable a) =>+ MemoFingerprintKey a -> Text -> GenHaxl u a -> GenHaxl u a #-} {-# NOINLINE memo #-} +-- | Memoize a computation using its location and a Fingerprint. This ensures+-- uniqueness across computations.+memoUnique+ :: (Typeable a, Typeable k, Hashable k, Eq k)+ => MemoFingerprintKey a -> k -> GenHaxl u a -> GenHaxl u a+memoUnique fp key = memo (fp, key)++{-# NOINLINE memoUnique #-}+ data MemoKey k a where MemoKey :: (Typeable k, Hashable k, Eq k) => k -> MemoKey k a deriving Typeable@@ -331,6 +345,16 @@ memoText :: (Typeable a) => Text -> GenHaxl u a -> GenHaxl u a memoText key = withLabel key . cachedComputation (MemoText key)++-- For Text keys, memoUnique is automatically rewritten to memoUniqueText,+-- due to the RULES pragma above.+memoUniqueText+ :: (Typeable a)+ => MemoFingerprintKey a+ -> Text+ -> GenHaxl u a+ -> GenHaxl u a+memoUniqueText fp key = withLabel key . memo (fp, key) -- | A memo key derived from a 128-bit MD5 hash. Do not use this directly, -- it is for use by automatically-generated memoization.
changelog.md view
@@ -1,3 +1,10 @@+# Changes in version 2.0.1.0++ * Exported MemoVar from Haxl.Core.Memo+ * Updated the facebook example+ * Fixed some links in the documentation+ * Bump some version bounds+ # Changes in version 2.0.0.0 * Completely rewritten internals to support arbitrarily overlapping
haxl.cabal view
@@ -1,5 +1,5 @@ name: haxl-version: 2.0.0.0+version: 2.0.1.0 synopsis: A Haskell library for efficient, concurrent, and concise data access. homepage: https://github.com/facebook/Haxl@@ -43,7 +43,7 @@ library build-depends:- aeson >= 0.6 && < 1.4,+ aeson >= 0.6 && < 1.5, base == 4.*, binary >= 0.7 && < 0.10, bytestring >= 0.9 && < 0.11,@@ -102,7 +102,7 @@ test-suite test build-depends:- aeson >= 0.6 && < 1.3,+ aeson, HUnit >= 1.2 && < 1.7, base == 4.*, binary,
readme.md view
@@ -7,7 +7,8 @@ * batch multiple requests to the same data source, * request data from multiple data sources concurrently,- * cache previous requests.+ * cache previous requests,+ * memoize computations. Having all this handled for you behind the scenes means that your data-fetching code can be much cleaner and clearer than it would@@ -37,7 +38,7 @@ explains how Haxl came about at Facebook, and discusses our particular use case. - * [An example Facebook data source](example/facebook/readme.md) walks+ * [An example Facebook data source](https://github.com/facebook/Haxl/blob/master/example/facebook/readme.md) walks through building an example data source that queries the Facebook Graph API concurrently. @@ -45,7 +46,7 @@ Walks through using Haxl from scratch for a simple SQLite-backed blog engine. - * [The N+1 Selects Problem](example/sql/readme.md) explains how Haxl+ * [The N+1 Selects Problem](https://github.com/facebook/Haxl/blob/master/example/sql/readme.md) explains how Haxl can address a common performance problem with SQL queries by automatically batching multiple queries into a single query, without the programmer having to specify this behavior.