haxl 0.4.0.1 → 0.4.0.2
raw patch · 7 files changed
+40/−18 lines, 7 filesdep ~HUnitnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: HUnit
API changes (from Hackage documentation)
- Haxl.Core: [MemoFingerprintKey] :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> Addr# -> Addr# -> MemoFingerprintKey a
- Haxl.Core: data family State f;
- Haxl.Core: }
- Haxl.Core.Exception: instance Data.Aeson.Types.ToJSON.ToJSON Haxl.Core.Exception.HaxlException
- Haxl.Core.Memo: [MemoFingerprintKey] :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> Addr# -> Addr# -> MemoFingerprintKey a
- Haxl.Core.Monad: instance Control.DeepSeq.NFData (Haxl.Core.Monad.GenHaxl u a)
- Haxl.Core.StateStore: data family State f;
- Haxl.Core.StateStore: }
- Haxl.Core.Types: instance Data.Aeson.Types.ToJSON.ToJSON Haxl.Core.Types.DataSourceRoundStats
- Haxl.Core.Types: instance Data.Aeson.Types.ToJSON.ToJSON Haxl.Core.Types.RoundStats
- Haxl.Core.Types: instance Data.Aeson.Types.ToJSON.ToJSON Haxl.Core.Types.Stats
- Haxl.Prelude: infix 4 ./=
- Haxl.Prelude: infixr 2 .||
- Haxl.Prelude: infixr 3 .&&
- Haxl.Prelude: instance u1 ~ u2 => Haxl.Prelude.IfThenElse (Haxl.Core.Monad.GenHaxl u1 GHC.Types.Bool) (Haxl.Core.Monad.GenHaxl u2 a)
+ Haxl.Core: MemoFingerprintKey :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> Addr# -> Addr# -> MemoFingerprintKey a
+ Haxl.Core.Exception: instance Data.Aeson.Types.Class.ToJSON Haxl.Core.Exception.HaxlException
+ Haxl.Core.Memo: MemoFingerprintKey :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> Addr# -> Addr# -> MemoFingerprintKey a
+ Haxl.Core.Types: instance Data.Aeson.Types.Class.ToJSON Haxl.Core.Types.DataSourceRoundStats
+ Haxl.Core.Types: instance Data.Aeson.Types.Class.ToJSON Haxl.Core.Types.RoundStats
+ Haxl.Core.Types: instance Data.Aeson.Types.Class.ToJSON Haxl.Core.Types.Stats
+ Haxl.Prelude: instance (u1 ~ u2) => Haxl.Prelude.IfThenElse (Haxl.Core.Monad.GenHaxl u1 GHC.Types.Bool) (Haxl.Core.Monad.GenHaxl u2 a)
- Haxl.Core: cachedComputation :: forall req u a. (Eq (req a), Hashable (req a), Typeable (req a)) => req a -> GenHaxl u a -> GenHaxl u a
+ Haxl.Core: cachedComputation :: (Eq (req a), Hashable (req a), Typeable (req a)) => req a -> GenHaxl u a -> GenHaxl u a
- Haxl.Core: class Typeable f => StateKey (f :: * -> *) where data State f where {
+ Haxl.Core: class Typeable f => StateKey (f :: * -> *) where data family State f
- Haxl.Core: ifProfiling :: (Functor m, Monad m) => Flags -> m a -> m ()
+ Haxl.Core: ifProfiling :: Monad m => Flags -> m a -> m ()
- Haxl.Core: ifReport :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ Haxl.Core: ifReport :: Monad m => Flags -> Int -> m a -> m ()
- Haxl.Core: ifTrace :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ Haxl.Core: ifTrace :: Monad m => Flags -> Int -> m a -> m ()
- Haxl.Core: stateGet :: forall r. StateKey r => StateStore -> Maybe (State r)
+ Haxl.Core: stateGet :: StateKey r => StateStore -> Maybe (State r)
- Haxl.Core: stateSet :: forall f. StateKey f => State f -> StateStore -> StateStore
+ Haxl.Core: stateSet :: StateKey f => State f -> StateStore -> StateStore
- Haxl.Core.Monad: cachedComputation :: forall req u a. (Eq (req a), Hashable (req a), Typeable (req a)) => req a -> GenHaxl u a -> GenHaxl u a
+ Haxl.Core.Monad: cachedComputation :: (Eq (req a), Hashable (req a), Typeable (req a)) => req a -> GenHaxl u a -> GenHaxl u a
- Haxl.Core.RequestStore: addRequest :: forall u r. (DataSource u r) => BlockedFetch r -> RequestStore u -> RequestStore u
+ Haxl.Core.RequestStore: addRequest :: (DataSource u r) => BlockedFetch r -> RequestStore u -> RequestStore u
- Haxl.Core.StateStore: class Typeable f => StateKey (f :: * -> *) where data State f where {
+ Haxl.Core.StateStore: class Typeable f => StateKey (f :: * -> *) where data family State f
- Haxl.Core.StateStore: stateGet :: forall r. StateKey r => StateStore -> Maybe (State r)
+ Haxl.Core.StateStore: stateGet :: StateKey r => StateStore -> Maybe (State r)
- Haxl.Core.StateStore: stateSet :: forall f. StateKey f => State f -> StateStore -> StateStore
+ Haxl.Core.StateStore: stateSet :: StateKey f => State f -> StateStore -> StateStore
- Haxl.Core.Types: ifProfiling :: (Functor m, Monad m) => Flags -> m a -> m ()
+ Haxl.Core.Types: ifProfiling :: Monad m => Flags -> m a -> m ()
- Haxl.Core.Types: ifReport :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ Haxl.Core.Types: ifReport :: Monad m => Flags -> Int -> m a -> m ()
- Haxl.Core.Types: ifTrace :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()
+ Haxl.Core.Types: ifTrace :: Monad m => Flags -> Int -> m a -> m ()
- Haxl.Prelude: (*>) :: f a -> f b -> f b
+ Haxl.Prelude: (*>) :: Applicative f => f a -> f b -> f b
- Haxl.Prelude: (<*) :: f a -> f b -> f a
+ Haxl.Prelude: (<*) :: Applicative f => f a -> f b -> f a
- Haxl.Prelude: (<*>) :: f (a -> b) -> f a -> f b
+ Haxl.Prelude: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
- Haxl.Prelude: filterM :: (Applicative f, Monad f) => (a -> f Bool) -> [a] -> f [a]
+ Haxl.Prelude: filterM :: (Applicative f) => (a -> f Bool) -> [a] -> f [a]
- Haxl.Prelude: fromString :: String -> a
+ Haxl.Prelude: fromString :: IsString a => String -> a
- Haxl.Prelude: mappend :: a -> a -> a
+ Haxl.Prelude: mappend :: Monoid a => a -> a -> a
- Haxl.Prelude: mconcat :: [a] -> a
+ Haxl.Prelude: mconcat :: Monoid a => [a] -> a
- Haxl.Prelude: mempty :: a
+ Haxl.Prelude: mempty :: Monoid a => a
- Haxl.Prelude: pure :: a -> f a
+ Haxl.Prelude: pure :: Applicative f => a -> f a
Files
- Haxl/Core/Exception.hs +3/−3
- Haxl/Core/Monad.hs +5/−2
- Haxl/Core/Types.hs +16/−3
- Haxl/Prelude.hs +5/−4
- haxl.cabal +2/−3
- tests/ExampleDataSource.hs +1/−1
- tests/MonadBench.hs +8/−2
Haxl/Core/Exception.hs view
@@ -100,7 +100,7 @@ -- (generic transient failure) or 'CriticalError' (internal failure). -- data HaxlException- = forall e. (Exception e, MiddleException e)+ = forall e. (MiddleException e) => HaxlException (Maybe Stack) -- filled in with the call stack when thrown, -- if PROFILING is on@@ -129,11 +129,11 @@ ] haxlExceptionToException- :: (Exception e, MiddleException e) => e -> SomeException+ :: (MiddleException e) => e -> SomeException haxlExceptionToException = toException . HaxlException Nothing haxlExceptionFromException- :: (Exception e, MiddleException e) => SomeException -> Maybe e+ :: (MiddleException e) => SomeException -> Maybe e haxlExceptionFromException x = do HaxlException _ a <- fromException x cast a
Haxl/Core/Monad.hs view
@@ -11,7 +11,6 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiWayIf #-}@@ -20,6 +19,11 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL >= 800+{-# OPTIONS_GHC -Wno-name-shadowing #-}+#else+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+#endif -- | The implementation of the 'Haxl' monad. Most users should -- import "Haxl.Core" instead of importing this module directly.@@ -183,7 +187,6 @@ -- newtype GenHaxl u a = GenHaxl { unHaxl :: Env u -> IORef (RequestStore u) -> IO (Result u a) }- deriving NFData -- | The result of a computation is either 'Done' with a value, 'Throw' -- with an exception, or 'Blocked' on the result of a data fetch with
Haxl/Core/Types.hs view
@@ -16,6 +16,11 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL >= 800+{-# OPTIONS_GHC -Wno-name-shadowing #-}+#else+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+#endif -- | Base types used by all of Haxl. Most users should import -- "Haxl.Core" instead of importing this module directly.@@ -135,16 +140,24 @@ , caching = 1 } +#if __GLASGOW_HASKELL__ >= 710+#define FUNMONAD Monad m+#else+#define FUNMONAD (Functor m, Monad m)+#endif+ -- | Runs an action if the tracing level is above the given threshold.-ifTrace :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()+ifTrace :: FUNMONAD => Flags -> Int -> m a -> m () ifTrace flags i = when (trace flags >= i) . void -- | Runs an action if the report level is above the given threshold.-ifReport :: (Functor m, Monad m) => Flags -> Int -> m a -> m ()+ifReport :: FUNMONAD => Flags -> Int -> m a -> m () ifReport flags i = when (report flags >= i) . void -ifProfiling :: (Functor m, Monad m) => Flags -> m a -> m ()+ifProfiling :: FUNMONAD => Flags -> m a -> m () ifProfiling flags = when (report flags >= 4) . void++#undef FUNMONAD -- --------------------------------------------------------------------------- -- Stats
Haxl/Prelude.hs view
@@ -189,10 +189,11 @@ sequence_ t = void $ sequenceA t -- | See 'mapM'.-filterM :: (Applicative f, Monad f) => (a -> f Bool) -> [a] -> f [a]-filterM pred xs = do- bools <- mapM pred xs- return [ x | (x,True) <- zip xs bools ]+filterM :: (Applicative f) => (a -> f Bool) -> [a] -> f [a]+filterM predicate xs =+ filt <$> mapM predicate xs+ where+ filt bools = [ x | (x,True) <- zip xs bools ] --------------------------------------------------------------------------------
haxl.cabal view
@@ -1,5 +1,5 @@ name: haxl-version: 0.4.0.1+version: 0.4.0.2 synopsis: A Haskell library for efficient, concurrent, and concise data access. homepage: https://github.com/facebook/Haxl@@ -42,7 +42,7 @@ library build-depends:- HUnit >= 1.2 && < 1.4,+ HUnit >= 1.2 && < 1.6, aeson >= 0.6 && < 1.1, base == 4.*, binary >= 0.7 && < 0.9,@@ -80,7 +80,6 @@ ghc-options: -Wall- -fno-warn-name-shadowing test-suite test
tests/ExampleDataSource.hs view
@@ -154,4 +154,4 @@ countAardvarks str = dataFetch (CountAardvarks str) listWombats :: Id -> GenHaxl () [Id]-listWombats id = dataFetch (ListWombats id)+listWombats i = dataFetch (ListWombats i)
tests/MonadBench.hs view
@@ -6,7 +6,12 @@ -- be found in the PATENTS file. -- | Benchmarking tool for core performance characteristics of the Haxl monad.-+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL >= 800+{-# OPTIONS_GHC -Wno-name-shadowing #-}+#else+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+#endif module MonadBench (main) where import Control.Monad@@ -32,6 +37,7 @@ let st = stateSet exstate stateEmpty initEnv st () +main :: IO () main = do [test,n_] <- getArgs let n = read n_@@ -49,7 +55,7 @@ foldr andThen (return ()) (replicate n (listWombats 3)) -- sequential, left-associated, distinct queries "seql" -> runHaxl env $ do- foldl andThen (return []) (map listWombats [1.. fromIntegral n])+ _ <- foldl andThen (return []) (map listWombats [1.. fromIntegral n]) return () "tree" -> runHaxl env $ void $ tree n -- No memoization