haxl 2.0.1.0 → 2.0.1.1
raw patch · 11 files changed
+58/−55 lines, 11 filesdep ~basedep ~containersdep ~stmPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, containers, stm
API changes (from Hackage documentation)
- Haxl.Core: numRounds :: Stats -> Int
- Haxl.Core.Stats: instance Data.Semigroup.Semigroup Haxl.Core.Stats.Stats
- Haxl.Core.Stats: numRounds :: Stats -> Int
- Haxl.Prelude: instance u1 ~ u2 => Haxl.Prelude.IfThenElse (Haxl.Core.Monad.GenHaxl u1 GHC.Types.Bool) (Haxl.Core.Monad.GenHaxl u2 a)
+ Haxl.Core.StateStore: instance GHC.Base.Monoid Haxl.Core.StateStore.StateStore
+ Haxl.Core.StateStore: instance GHC.Base.Semigroup Haxl.Core.StateStore.StateStore
+ Haxl.Core.Stats: instance GHC.Base.Semigroup Haxl.Core.Stats.Stats
+ Haxl.Prelude: (!!) :: () => [a] -> Int -> a
+ Haxl.Prelude: ($!) :: () => a -> b -> a -> b
+ Haxl.Prelude: ($) :: () => a -> b -> a -> b
+ Haxl.Prelude: (&&) :: Bool -> Bool -> Bool
+ Haxl.Prelude: (*) :: Num a => a -> a -> a
+ Haxl.Prelude: (**) :: Floating a => a -> a -> a
+ Haxl.Prelude: (+) :: Num a => a -> a -> a
+ Haxl.Prelude: (++) :: () => [a] -> [a] -> [a]
+ Haxl.Prelude: (-) :: Num a => a -> a -> a
+ Haxl.Prelude: (.) :: () => b -> c -> a -> b -> a -> c
+ Haxl.Prelude: (/) :: Fractional a => a -> a -> a
+ Haxl.Prelude: (/=) :: Eq a => a -> a -> Bool
+ Haxl.Prelude: (<$) :: Functor f => a -> f b -> f a
+ Haxl.Prelude: (<$>) :: Functor f => a -> b -> f a -> f b
+ Haxl.Prelude: (<) :: Ord a => a -> a -> Bool
+ Haxl.Prelude: (<=) :: Ord a => a -> a -> Bool
+ Haxl.Prelude: (<>) :: Semigroup a => a -> a -> a
+ Haxl.Prelude: (=<<) :: Monad m => a -> m b -> m a -> m b
+ Haxl.Prelude: (==) :: Eq a => a -> a -> Bool
+ Haxl.Prelude: (>) :: Ord a => a -> a -> Bool
+ Haxl.Prelude: (>=) :: Ord a => a -> a -> Bool
+ Haxl.Prelude: (>>) :: Monad m => m a -> m b -> m b
+ Haxl.Prelude: (>>=) :: Monad m => m a -> a -> m b -> m b
+ Haxl.Prelude: (^) :: (Num a, Integral b) => a -> b -> a
+ Haxl.Prelude: (^^) :: (Fractional a, Integral b) => a -> b -> a
+ Haxl.Prelude: (||) :: Bool -> Bool -> Bool
+ Haxl.Prelude: EQ :: Ordering
+ Haxl.Prelude: False :: Bool
+ Haxl.Prelude: GT :: Ordering
+ Haxl.Prelude: Just :: a -> Maybe a
+ Haxl.Prelude: LT :: Ordering
+ Haxl.Prelude: Left :: a -> Either a b
+ Haxl.Prelude: Nothing :: Maybe a
+ Haxl.Prelude: Right :: b -> Either a b
+ Haxl.Prelude: True :: Bool
+ Haxl.Prelude: abs :: Num a => a -> a
+ Haxl.Prelude: acos :: Floating a => a -> a
+ Haxl.Prelude: acosh :: Floating a => a -> a
+ Haxl.Prelude: all :: Foldable t => a -> Bool -> t a -> Bool
+ Haxl.Prelude: and :: Foldable t => t Bool -> Bool
+ Haxl.Prelude: any :: Foldable t => a -> Bool -> t a -> Bool
+ Haxl.Prelude: appendFile :: FilePath -> String -> IO ()
+ Haxl.Prelude: asTypeOf :: () => a -> a -> a
+ Haxl.Prelude: asin :: Floating a => a -> a
+ Haxl.Prelude: asinh :: Floating a => a -> a
+ Haxl.Prelude: atan :: Floating a => a -> a
+ Haxl.Prelude: atan2 :: RealFloat a => a -> a -> a
+ Haxl.Prelude: atanh :: Floating a => a -> a
+ Haxl.Prelude: break :: () => a -> Bool -> [a] -> ([a], [a])
+ Haxl.Prelude: ceiling :: (RealFrac a, Integral b) => a -> b
+ Haxl.Prelude: class Bounded a
+ Haxl.Prelude: class Enum a
+ Haxl.Prelude: class Eq a
+ Haxl.Prelude: class Fractional a => Floating a
+ Haxl.Prelude: class Foldable (t :: * -> *)
+ Haxl.Prelude: class Num a => Fractional a
+ Haxl.Prelude: class Functor (f :: * -> *)
+ Haxl.Prelude: class (Real a, Enum a) => Integral a
+ Haxl.Prelude: class Applicative m => Monad (m :: * -> *)
+ Haxl.Prelude: class Num a
+ Haxl.Prelude: class Eq a => Ord a
+ Haxl.Prelude: class Read a
+ Haxl.Prelude: class (Num a, Ord a) => Real a
+ Haxl.Prelude: class (RealFrac a, Floating a) => RealFloat a
+ Haxl.Prelude: class (Real a, Fractional a) => RealFrac a
+ Haxl.Prelude: class Semigroup a
+ Haxl.Prelude: class Show a
+ Haxl.Prelude: class (Functor t, Foldable t) => Traversable (t :: * -> *)
+ Haxl.Prelude: compare :: Ord a => a -> a -> Ordering
+ Haxl.Prelude: concat :: Foldable t => t [a] -> [a]
+ Haxl.Prelude: concatMap :: Foldable t => a -> [b] -> t a -> [b]
+ Haxl.Prelude: const :: () => a -> b -> a
+ Haxl.Prelude: cos :: Floating a => a -> a
+ Haxl.Prelude: cosh :: Floating a => a -> a
+ Haxl.Prelude: curry :: () => (a, b) -> c -> a -> b -> c
+ Haxl.Prelude: cycle :: () => [a] -> [a]
+ Haxl.Prelude: data Bool
+ Haxl.Prelude: data Char
+ Haxl.Prelude: data Double
+ Haxl.Prelude: data Either a b
+ Haxl.Prelude: data Float
+ Haxl.Prelude: data IO a
+ Haxl.Prelude: data Int
+ Haxl.Prelude: data Integer
+ Haxl.Prelude: data Maybe a
+ Haxl.Prelude: data Ordering
+ Haxl.Prelude: data Word
+ Haxl.Prelude: decodeFloat :: RealFloat a => a -> (Integer, Int)
+ Haxl.Prelude: div :: Integral a => a -> a -> a
+ Haxl.Prelude: divMod :: Integral a => a -> a -> (a, a)
+ Haxl.Prelude: drop :: () => Int -> [a] -> [a]
+ Haxl.Prelude: dropWhile :: () => a -> Bool -> [a] -> [a]
+ Haxl.Prelude: either :: () => a -> c -> b -> c -> Either a b -> c
+ Haxl.Prelude: elem :: (Foldable t, Eq a) => a -> t a -> Bool
+ Haxl.Prelude: encodeFloat :: RealFloat a => Integer -> Int -> a
+ Haxl.Prelude: enumFrom :: Enum a => a -> [a]
+ Haxl.Prelude: enumFromThen :: Enum a => a -> a -> [a]
+ Haxl.Prelude: enumFromThenTo :: Enum a => a -> a -> a -> [a]
+ Haxl.Prelude: enumFromTo :: Enum a => a -> a -> [a]
+ Haxl.Prelude: error :: HasCallStack => [Char] -> a
+ Haxl.Prelude: errorWithoutStackTrace :: () => [Char] -> a
+ Haxl.Prelude: even :: Integral a => a -> Bool
+ Haxl.Prelude: exp :: Floating a => a -> a
+ Haxl.Prelude: exponent :: RealFloat a => a -> Int
+ Haxl.Prelude: fail :: Monad m => String -> m a
+ Haxl.Prelude: filter :: () => a -> Bool -> [a] -> [a]
+ Haxl.Prelude: flip :: () => a -> b -> c -> b -> a -> c
+ Haxl.Prelude: floatDigits :: RealFloat a => a -> Int
+ Haxl.Prelude: floatRadix :: RealFloat a => a -> Integer
+ Haxl.Prelude: floatRange :: RealFloat a => a -> (Int, Int)
+ Haxl.Prelude: floor :: (RealFrac a, Integral b) => a -> b
+ Haxl.Prelude: fmap :: Functor f => a -> b -> f a -> f b
+ Haxl.Prelude: foldMap :: (Foldable t, Monoid m) => a -> m -> t a -> m
+ Haxl.Prelude: foldl :: Foldable t => b -> a -> b -> b -> t a -> b
+ Haxl.Prelude: foldl1 :: Foldable t => a -> a -> a -> t a -> a
+ Haxl.Prelude: foldr :: Foldable t => a -> b -> b -> b -> t a -> b
+ Haxl.Prelude: foldr1 :: Foldable t => a -> a -> a -> t a -> a
+ Haxl.Prelude: fromEnum :: Enum a => a -> Int
+ Haxl.Prelude: fromInteger :: Num a => Integer -> a
+ Haxl.Prelude: fromIntegral :: (Integral a, Num b) => a -> b
+ Haxl.Prelude: fromRational :: Fractional a => Rational -> a
+ Haxl.Prelude: fst :: () => (a, b) -> a
+ Haxl.Prelude: gcd :: Integral a => a -> a -> a
+ Haxl.Prelude: getChar :: IO Char
+ Haxl.Prelude: getContents :: IO String
+ Haxl.Prelude: getLine :: IO String
+ Haxl.Prelude: head :: () => [a] -> a
+ Haxl.Prelude: id :: () => a -> a
+ Haxl.Prelude: infixl 4 <$>
+ Haxl.Prelude: infixl 9 !!
+ Haxl.Prelude: infixr 0 $!
+ Haxl.Prelude: infixr 1 =<<
+ Haxl.Prelude: infixr 8 ^
+ Haxl.Prelude: infixr 9 .
+ Haxl.Prelude: init :: () => [a] -> [a]
+ Haxl.Prelude: instance (u1 ~ u2) => Haxl.Prelude.IfThenElse (Haxl.Core.Monad.GenHaxl u1 GHC.Types.Bool) (Haxl.Core.Monad.GenHaxl u2 a)
+ Haxl.Prelude: interact :: String -> String -> IO ()
+ Haxl.Prelude: ioError :: () => IOError -> IO a
+ Haxl.Prelude: isDenormalized :: RealFloat a => a -> Bool
+ Haxl.Prelude: isIEEE :: RealFloat a => a -> Bool
+ Haxl.Prelude: isInfinite :: RealFloat a => a -> Bool
+ Haxl.Prelude: isNaN :: RealFloat a => a -> Bool
+ Haxl.Prelude: isNegativeZero :: RealFloat a => a -> Bool
+ Haxl.Prelude: iterate :: () => a -> a -> a -> [a]
+ Haxl.Prelude: last :: () => [a] -> a
+ Haxl.Prelude: lcm :: Integral a => a -> a -> a
+ Haxl.Prelude: length :: Foldable t => t a -> Int
+ Haxl.Prelude: lex :: ReadS String
+ Haxl.Prelude: lines :: String -> [String]
+ Haxl.Prelude: log :: Floating a => a -> a
+ Haxl.Prelude: logBase :: Floating a => a -> a -> a
+ Haxl.Prelude: lookup :: Eq a => a -> [(a, b)] -> Maybe b
+ Haxl.Prelude: map :: () => a -> b -> [a] -> [b]
+ Haxl.Prelude: max :: Ord a => a -> a -> a
+ Haxl.Prelude: maxBound :: Bounded a => a
+ Haxl.Prelude: maximum :: (Foldable t, Ord a) => t a -> a
+ Haxl.Prelude: maybe :: () => b -> a -> b -> Maybe a -> b
+ Haxl.Prelude: min :: Ord a => a -> a -> a
+ Haxl.Prelude: minBound :: Bounded a => a
+ Haxl.Prelude: minimum :: (Foldable t, Ord a) => t a -> a
+ Haxl.Prelude: mod :: Integral a => a -> a -> a
+ Haxl.Prelude: negate :: Num a => a -> a
+ Haxl.Prelude: not :: Bool -> Bool
+ Haxl.Prelude: notElem :: (Foldable t, Eq a) => a -> t a -> Bool
+ Haxl.Prelude: null :: Foldable t => t a -> Bool
+ Haxl.Prelude: odd :: Integral a => a -> Bool
+ Haxl.Prelude: or :: Foldable t => t Bool -> Bool
+ Haxl.Prelude: otherwise :: Bool
+ Haxl.Prelude: pi :: Floating a => a
+ Haxl.Prelude: pred :: Enum a => a -> a
+ Haxl.Prelude: print :: Show a => a -> IO ()
+ Haxl.Prelude: product :: (Foldable t, Num a) => t a -> a
+ Haxl.Prelude: properFraction :: (RealFrac a, Integral b) => a -> (b, a)
+ Haxl.Prelude: putChar :: Char -> IO ()
+ Haxl.Prelude: putStr :: String -> IO ()
+ Haxl.Prelude: putStrLn :: String -> IO ()
+ Haxl.Prelude: quot :: Integral a => a -> a -> a
+ Haxl.Prelude: quotRem :: Integral a => a -> a -> (a, a)
+ Haxl.Prelude: read :: Read a => String -> a
+ Haxl.Prelude: readFile :: FilePath -> IO String
+ Haxl.Prelude: readIO :: Read a => String -> IO a
+ Haxl.Prelude: readList :: Read a => ReadS [a]
+ Haxl.Prelude: readLn :: Read a => IO a
+ Haxl.Prelude: readParen :: () => Bool -> ReadS a -> ReadS a
+ Haxl.Prelude: reads :: Read a => ReadS a
+ Haxl.Prelude: readsPrec :: Read a => Int -> ReadS a
+ Haxl.Prelude: realToFrac :: (Real a, Fractional b) => a -> b
+ Haxl.Prelude: recip :: Fractional a => a -> a
+ Haxl.Prelude: rem :: Integral a => a -> a -> a
+ Haxl.Prelude: repeat :: () => a -> [a]
+ Haxl.Prelude: replicate :: () => Int -> a -> [a]
+ Haxl.Prelude: return :: Monad m => a -> m a
+ Haxl.Prelude: reverse :: () => [a] -> [a]
+ Haxl.Prelude: round :: (RealFrac a, Integral b) => a -> b
+ Haxl.Prelude: scaleFloat :: RealFloat a => Int -> a -> a
+ Haxl.Prelude: scanl :: () => b -> a -> b -> b -> [a] -> [b]
+ Haxl.Prelude: scanl1 :: () => a -> a -> a -> [a] -> [a]
+ Haxl.Prelude: scanr :: () => a -> b -> b -> b -> [a] -> [b]
+ Haxl.Prelude: scanr1 :: () => a -> a -> a -> [a] -> [a]
+ Haxl.Prelude: seq :: () => a -> b -> b
+ Haxl.Prelude: sequenceA :: (Traversable t, Applicative f) => t f a -> f t a
+ Haxl.Prelude: show :: Show a => a -> String
+ Haxl.Prelude: showChar :: Char -> ShowS
+ Haxl.Prelude: showList :: Show a => [a] -> ShowS
+ Haxl.Prelude: showParen :: Bool -> ShowS -> ShowS
+ Haxl.Prelude: showString :: String -> ShowS
+ Haxl.Prelude: shows :: Show a => a -> ShowS
+ Haxl.Prelude: showsPrec :: Show a => Int -> a -> ShowS
+ Haxl.Prelude: significand :: RealFloat a => a -> a
+ Haxl.Prelude: signum :: Num a => a -> a
+ Haxl.Prelude: sin :: Floating a => a -> a
+ Haxl.Prelude: sinh :: Floating a => a -> a
+ Haxl.Prelude: snd :: () => (a, b) -> b
+ Haxl.Prelude: span :: () => a -> Bool -> [a] -> ([a], [a])
+ Haxl.Prelude: splitAt :: () => Int -> [a] -> ([a], [a])
+ Haxl.Prelude: sqrt :: Floating a => a -> a
+ Haxl.Prelude: subtract :: Num a => a -> a -> a
+ Haxl.Prelude: succ :: Enum a => a -> a
+ Haxl.Prelude: sum :: (Foldable t, Num a) => t a -> a
+ Haxl.Prelude: tail :: () => [a] -> [a]
+ Haxl.Prelude: take :: () => Int -> [a] -> [a]
+ Haxl.Prelude: takeWhile :: () => a -> Bool -> [a] -> [a]
+ Haxl.Prelude: tan :: Floating a => a -> a
+ Haxl.Prelude: tanh :: Floating a => a -> a
+ Haxl.Prelude: toEnum :: Enum a => Int -> a
+ Haxl.Prelude: toInteger :: Integral a => a -> Integer
+ Haxl.Prelude: toRational :: Real a => a -> Rational
+ Haxl.Prelude: traverse :: (Traversable t, Applicative f) => a -> f b -> t a -> f t b
+ Haxl.Prelude: truncate :: (RealFrac a, Integral b) => a -> b
+ Haxl.Prelude: type FilePath = String
+ Haxl.Prelude: type IOError = IOException
+ Haxl.Prelude: type Rational = Ratio Integer
+ Haxl.Prelude: type ReadS a = String -> [(a, String)]
+ Haxl.Prelude: type ShowS = String -> String
+ Haxl.Prelude: type String = [Char]
+ Haxl.Prelude: uncurry :: () => a -> b -> c -> (a, b) -> c
+ Haxl.Prelude: undefined :: HasCallStack => a
+ Haxl.Prelude: unlines :: [String] -> String
+ Haxl.Prelude: until :: () => a -> Bool -> a -> a -> a -> a
+ Haxl.Prelude: unwords :: [String] -> String
+ Haxl.Prelude: unzip :: () => [(a, b)] -> ([a], [b])
+ Haxl.Prelude: unzip3 :: () => [(a, b, c)] -> ([a], [b], [c])
+ Haxl.Prelude: userError :: String -> IOError
+ Haxl.Prelude: words :: String -> [String]
+ Haxl.Prelude: writeFile :: FilePath -> String -> IO ()
+ Haxl.Prelude: zip :: () => [a] -> [b] -> [(a, b)]
+ Haxl.Prelude: zip3 :: () => [a] -> [b] -> [c] -> [(a, b, c)]
+ Haxl.Prelude: zipWith :: () => a -> b -> c -> [a] -> [b] -> [c]
+ Haxl.Prelude: zipWith3 :: () => a -> b -> c -> d -> [a] -> [b] -> [c] -> [d]
- Haxl.Core: GenHaxl :: (Env u -> IO (Result u a)) -> GenHaxl u a
+ Haxl.Core: GenHaxl :: Env u -> IO (Result u a) -> GenHaxl u a
- Haxl.Core: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> k -> GenHaxl u a -> GenHaxl u a
+ Haxl.Core: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> Text -> k -> GenHaxl u a -> GenHaxl u a
- Haxl.Core.Memo: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> k -> GenHaxl u a -> GenHaxl u a
+ Haxl.Core.Memo: memoUnique :: (Typeable a, Typeable k, Hashable k, Eq k) => MemoFingerprintKey a -> Text -> k -> GenHaxl u a -> GenHaxl u a
- Haxl.Core.Monad: GenHaxl :: (Env u -> IO (Result u a)) -> GenHaxl u a
+ Haxl.Core.Monad: GenHaxl :: Env u -> IO (Result u a) -> GenHaxl u a
- Haxl.Prelude: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
+ Haxl.Prelude: (<*>) :: Applicative f => f a -> b -> f a -> f b
- Haxl.Prelude: class Monoid a
+ Haxl.Prelude: class Semigroup a => Monoid a
- Haxl.Prelude: data Text :: *
+ Haxl.Prelude: data Text
- Haxl.Prelude: foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
+ Haxl.Prelude: foldM :: (Foldable t, Monad m) => b -> a -> m b -> b -> t a -> m b
- Haxl.Prelude: foldl' :: Foldable t => forall b a. () => (b -> a -> b) -> b -> t a -> b
+ Haxl.Prelude: foldl' :: Foldable t => b -> a -> b -> b -> t a -> b
- Haxl.Prelude: liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
+ Haxl.Prelude: liftA2 :: Applicative f => a -> b -> c -> f a -> f b -> f c
Files
- Haxl/Core.hs +0/−1
- Haxl/Core/Memo.hs +2/−14
- Haxl/Core/Monad.hs +6/−1
- Haxl/Core/StateStore.hs +13/−0
- Haxl/Core/Stats.hs +0/−4
- changelog.md +5/−0
- haxl.cabal +6/−6
- readme.md +2/−2
- tests/AdoTests.hs +3/−3
- tests/BatchTests.hs +13/−14
- tests/TestUtils.hs +8/−10
Haxl/Core.hs view
@@ -43,7 +43,6 @@ , Microseconds , Timestamp , emptyStats- , numRounds , numFetches , ppStats , ppFetchStats
Haxl/Core/Memo.hs view
@@ -307,8 +307,6 @@ {-# 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 #-}@@ -317,8 +315,8 @@ -- 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)+ => MemoFingerprintKey a -> Text -> k -> GenHaxl u a -> GenHaxl u a+memoUnique fp label key = withLabel label . memo (fp, key) {-# NOINLINE memoUnique #-} @@ -345,16 +343,6 @@ 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.
Haxl/Core/Monad.hs view
@@ -758,8 +758,13 @@ cache <- readIORef ref showCache cache readIVar + let+ body = if null entries+ then text "return ()"+ else vcat (map mk_cr (concatMap snd entries))+ return $ show $ text (fnName ++ " :: " ++ fnType) $$ text (fnName ++ " = do") $$- nest 2 (vcat (map mk_cr (concatMap snd entries))) $$+ nest 2 body $$ text "" -- final newline
Haxl/Core/StateStore.hs view
@@ -24,6 +24,9 @@ import Data.Map (Map) import qualified Data.Map.Strict as Map+#if __GLASGOW_HASKELL__ < 804+import Data.Monoid+#endif import Data.Typeable import Unsafe.Coerce @@ -46,6 +49,16 @@ -- | The 'StateStore' maps a 'StateKey' to the 'State' for that type. newtype StateStore = StateStore (Map TypeRep StateStoreData)++#if __GLASGOW_HASKELL__ >= 804+instance Semigroup StateStore where+ (<>) = mappend+#endif++instance Monoid StateStore where+ mempty = stateEmpty+ -- Left-biased union+ mappend (StateStore m1) (StateStore m2) = StateStore $ m1 <> m2 -- | Encapsulates the type of 'StateStore' data so we can have a -- heterogeneous collection.
Haxl/Core/Stats.hs view
@@ -23,7 +23,6 @@ , Timestamp , getTimestamp , emptyStats- , numRounds , numFetches , ppStats , ppFetchStats@@ -158,9 +157,6 @@ emptyStats :: Stats emptyStats = Stats []--numRounds :: Stats -> Int-numRounds (Stats rs) = length rs -- not really numFetches :: Stats -> Int numFetches (Stats rs) = sum [ fetchBatchSize | FetchStats{..} <- rs ]
changelog.md view
@@ -1,3 +1,8 @@+# Changes in version 2.0.1.1++ * Support for GHC 8.6.1+ * Bugfixes+ # Changes in version 2.0.1.0 * Exported MemoVar from Haxl.Core.Memo
haxl.cabal view
@@ -1,5 +1,5 @@ name: haxl-version: 2.0.1.0+version: 2.0.1.1 synopsis: A Haskell library for efficient, concurrent, and concise data access. homepage: https://github.com/facebook/Haxl@@ -18,7 +18,7 @@ GHC==7.10.3, GHC==8.0.2, GHC==8.2.2,- GHC==8.4.1+ GHC==8.4.3 description: Haxl is a library and EDSL for efficient scheduling of concurrent data@@ -44,10 +44,10 @@ build-depends: aeson >= 0.6 && < 1.5,- base == 4.*,+ base >= 4.7 && < 5, binary >= 0.7 && < 0.10, bytestring >= 0.9 && < 0.11,- containers == 0.5.*,+ containers >= 0.5 && < 0.7, deepseq, exceptions >=0.8 && <0.11, filepath >= 1.3 && < 1.5,@@ -57,7 +57,7 @@ -- text 1.2.1.0 required for instance Binary Text text >= 1.2.1.0 && < 1.3, time >= 1.4 && < 1.9,- stm == 2.4.*,+ stm >= 2.4 && < 2.6, transformers, unordered-containers == 0.2.*, vector >= 0.10 && <0.13@@ -104,7 +104,7 @@ build-depends: aeson, HUnit >= 1.2 && < 1.7,- base == 4.*,+ base >= 4.7 && < 5, binary, bytestring, containers,
readme.md view
@@ -18,7 +18,7 @@ There are two Haskell packages here: * `haxl`: The core Haxl framework- * `haxl-facebook` (in [example/facebook](example/facebook)): An (incomplete) example data source for accessing the Facebook Graph API+ * `haxl-facebook` (in [https://github.com/facebook/Haxl/tree/master/example/facebook](example/facebook)): An (incomplete) example data source for accessing the Facebook Graph API To use Haxl in your own application, you will likely need to build one or more *data sources*: the thin layer between Haxl and the data that you want@@ -54,6 +54,6 @@ * [Haxl Documentation](http://hackage.haskell.org/package/haxl) on Hackage. - * [There is no Fork: An Abstraction for Efficient, Concurrent, and Concise Data Access](http://community.haskell.org/~simonmar/papers/haxl-icfp14.pdf), our paper on Haxl, accepted for publication at ICFP'14.+ * [There is no Fork: An Abstraction for Efficient, Concurrent, and Concise Data Access](http://simonmar.github.io/bib/papers/haxl-icfp14.pdf), our paper on Haxl, accepted for publication at ICFP'14. [](https://travis-ci.org/facebook/Haxl)
tests/AdoTests.hs view
@@ -21,14 +21,14 @@ -- -- Test ApplicativeDo batching ---ado1 = expectRounds 1 12 ado1_+ado1 = expectResult 12 ado1_ ado1_ = do a <- friendsOf =<< id1 b <- friendsOf =<< id2 return (length (a ++ b)) -ado2 = expectRounds 1 12 ado2_+ado2 = expectResult 12 ado2_ ado2_ = do x <- id1@@ -37,7 +37,7 @@ b <- friendsOf y return (length (a ++ b)) -ado3 = expectRounds 2 11 ado3_+ado3 = expectResult 11 ado3_ ado3_ = do x <- id1
tests/BatchTests.hs view
@@ -25,7 +25,7 @@ -- -- Test batching over multiple arguments in liftA2 ---batching1 = expectRounds 1 12 batching1_+batching1 = expectResult 12 batching1_ batching1_ = do a <- id1@@ -35,7 +35,7 @@ -- -- Test batching in mapM (which is really traverse) ---batching2 = expectRounds 1 12 batching2_+batching2 = expectResult 12 batching2_ batching2_ = do a <- id1@@ -46,7 +46,7 @@ -- -- Test batching when we have a monadic bind in each branch ---batching3 = expectRounds 1 12 batching3_+batching3 = expectResult 12 batching3_ batching3_ = do let a = id1 >>= friendsOf@@ -56,7 +56,7 @@ -- -- Test batching over both arguments of (+) ---batching4 = expectRounds 1 12 batching4_+batching4 = expectResult 12 batching4_ batching4_ = do let a = length <$> (id1 >>= friendsOf)@@ -66,7 +66,7 @@ -- -- Test batching over both arguments of (+) ---batching5 = expectRounds 1 2 batching5_+batching5 = expectResult 2 batching5_ batching5_ :: Haxl Int batching5_ = if a .> b then 1 else 2@@ -77,14 +77,14 @@ -- -- Test batching when we perform all batching tests together with sequence ---batching6 = expectRounds 1 [12,12,12,12,2] batching6_+batching6 = expectResult [12,12,12,12,2] batching6_ batching6_ = sequence [batching1_,batching2_,batching3_,batching4_,batching5_] -- -- Ensure if/then/else and bool operators break batching ---batching7 = expectRounds 2 12 batching7_+batching7 = expectResult 12 batching7_ batching7_ :: Haxl Int batching7_ = if a .> 0 then a+b else 0@@ -93,7 +93,7 @@ b = length <$> (id2 >>= friendsOf) -- We expect 3 rounds here due to boolean operators-batching8 = expectRounds 3 12 batching8_+batching8 = expectResult 12 batching8_ batching8_ :: Haxl Int batching8_ = if (c .== 0) .|| (a .> 0 .&& b .> 0) then a+b else 0@@ -103,7 +103,7 @@ c = length <$> (id3 >>= friendsOf) -- (>>) should batch, so we expect one round-batching9 = expectRounds 1 6 batching9_+batching9 = expectResult 6 batching9_ batching9_ :: Haxl Int batching9_ = (id1 >>= friendsOf) >> (length <$> (id2 >>= friendsOf))@@ -135,7 +135,7 @@ -- cacheReuse future = do env <- makeTestEnv future- expectRoundsWithEnv 2 12 batching7_ env+ expectResultWithEnv 12 batching7_ env -- make a new env tao <- MockTAO.initGlobalState future@@ -143,7 +143,7 @@ env2 <- initEnvWithData st testinput (caches env) -- ensure no more data fetching rounds needed- expectRoundsWithEnv 0 12 batching7_ env2+ expectResultWithEnv 12 batching7_ env2 noCaching future = do env <- makeTestEnv future@@ -151,13 +151,12 @@ result <- runHaxl env' caching3_ assertEqual "result" result 18 stats <- readIORef (statsRef env)- assertEqual "rounds" 2 (numRounds stats) assertEqual "fetches" 4 (numFetches stats) -exceptionTest1 = expectRounds 1 []+exceptionTest1 = expectResult [] $ withDefault [] $ friendsOf 101 -exceptionTest2 = expectRounds 1 [7..12] $ liftA2 (++)+exceptionTest2 = expectResult [7..12] $ liftA2 (++) (withDefault [] (friendsOf 101)) (withDefault [] (friendsOf 2))
tests/TestUtils.hs view
@@ -7,8 +7,8 @@ {-# LANGUAGE OverloadedStrings #-} module TestUtils ( makeTestEnv- , expectRoundsWithEnv- , expectRounds+ , expectResultWithEnv+ , expectResult , expectFetches , testinput , id1, id2, id3, id4@@ -53,18 +53,16 @@ env <- initEnv st testinput return env { flags = (flags env) { report = 2 } } -expectRoundsWithEnv- :: (Eq a, Show a) => Int -> a -> Haxl a -> Env UserEnv -> Assertion-expectRoundsWithEnv n result haxl env = do+expectResultWithEnv+ :: (Eq a, Show a) => a -> Haxl a -> Env UserEnv -> Assertion+expectResultWithEnv result haxl env = do a <- runHaxl env haxl assertEqual "result" result a- stats <- readIORef (statsRef env)- assertEqual "rounds" n (numRounds stats) -expectRounds :: (Eq a, Show a) => Int -> a -> Haxl a -> Bool -> Assertion-expectRounds n result haxl future = do+expectResult :: (Eq a, Show a) => a -> Haxl a -> Bool -> Assertion+expectResult result haxl future = do env <- makeTestEnv future- expectRoundsWithEnv n result haxl env+ expectResultWithEnv result haxl env expectFetches :: (Eq a, Show a) => Int -> Haxl a -> Bool -> Assertion expectFetches n haxl future = do