{-# LANGUAGE AllowAmbiguousTypes #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} module Mischief.ECS.World.Query.Queryable where import Control.Applicative import Data.Bifunctor qualified import Data.Data import Data.Maybe import Data.Set (Set) import Data.Set qualified as Set import Data.Traversable import Mischief.ECS.Components import Mischief.ECS.Entities import Mischief.ECS.Mappable import Mischief.ECS.Tables import Mischief.ECS.World import Mischief.ECS.World.Utils data TypeQuery = CompQ | RelQ | RelQ' Entity deriving (TypeQuery -> TypeQuery -> Bool (TypeQuery -> TypeQuery -> Bool) -> (TypeQuery -> TypeQuery -> Bool) -> Eq TypeQuery forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: TypeQuery -> TypeQuery -> Bool == :: TypeQuery -> TypeQuery -> Bool $c/= :: TypeQuery -> TypeQuery -> Bool /= :: TypeQuery -> TypeQuery -> Bool Eq, Eq TypeQuery Eq TypeQuery => (TypeQuery -> TypeQuery -> Ordering) -> (TypeQuery -> TypeQuery -> Bool) -> (TypeQuery -> TypeQuery -> Bool) -> (TypeQuery -> TypeQuery -> Bool) -> (TypeQuery -> TypeQuery -> Bool) -> (TypeQuery -> TypeQuery -> TypeQuery) -> (TypeQuery -> TypeQuery -> TypeQuery) -> Ord TypeQuery TypeQuery -> TypeQuery -> Bool TypeQuery -> TypeQuery -> Ordering TypeQuery -> TypeQuery -> TypeQuery forall a. Eq a => (a -> a -> Ordering) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> a) -> (a -> a -> a) -> Ord a $ccompare :: TypeQuery -> TypeQuery -> Ordering compare :: TypeQuery -> TypeQuery -> Ordering $c< :: TypeQuery -> TypeQuery -> Bool < :: TypeQuery -> TypeQuery -> Bool $c<= :: TypeQuery -> TypeQuery -> Bool <= :: TypeQuery -> TypeQuery -> Bool $c> :: TypeQuery -> TypeQuery -> Bool > :: TypeQuery -> TypeQuery -> Bool $c>= :: TypeQuery -> TypeQuery -> Bool >= :: TypeQuery -> TypeQuery -> Bool $cmax :: TypeQuery -> TypeQuery -> TypeQuery max :: TypeQuery -> TypeQuery -> TypeQuery $cmin :: TypeQuery -> TypeQuery -> TypeQuery min :: TypeQuery -> TypeQuery -> TypeQuery Ord, Int -> TypeQuery -> ShowS [TypeQuery] -> ShowS TypeQuery -> String (Int -> TypeQuery -> ShowS) -> (TypeQuery -> String) -> ([TypeQuery] -> ShowS) -> Show TypeQuery forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> TypeQuery -> ShowS showsPrec :: Int -> TypeQuery -> ShowS $cshow :: TypeQuery -> String show :: TypeQuery -> String $cshowList :: [TypeQuery] -> ShowS showList :: [TypeQuery] -> ShowS Show) newtype MR a b = MR b data Has a = Has newtype HasR a b = HasR b data E = E data C a = C newtype R a b = R b newtype R' a b = R' b data Any = Any data RelTarget = AnyTarget | RelTargets [Entities] data M a = M newtype Q a = Q a newtype MQ a = MQ a newtype Val a = Val a class Queryable qd output | qd -> output where runQueryEntity :: qd -> World -> Entity -> IO (Maybe output) runQueryInternal :: qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] queryTypes :: qd -> Set (TypeRep, TypeQuery) data HTrue data HFalse type family IsComponentC c where IsComponentC Entity = HFalse IsComponentC a = HTrue instance {-# OVERLAPPABLE #-} (Component c) => Queryable (C c) (Result c) where runQueryEntity :: C c -> World -> Entity -> IO (Maybe (Result c)) runQueryEntity C c _ World world Entity entity = do result <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe c)) tryGetEntityComponent @c World world Entity entity return $ case result of Just (Just c res) -> Result c -> Maybe (Result c) forall a. a -> Maybe a Just (Result c -> Maybe (Result c)) -> Result c -> Maybe (Result c) forall a b. (a -> b) -> a -> b $ (c, Entity) -> Result c forall c. (c, Entity) -> Result c Result (c res, Entity entity) Maybe (Maybe c) _ -> Maybe (Result c) forall a. Maybe a Nothing runQueryInternal :: C c -> [ArchetypeId] -> World -> IO [(Entity, Bool, Result c)] runQueryInternal C c _ [ArchetypeId] archetypes World world = ((Entity, Result c) -> (Entity, Bool, Result c)) -> [(Entity, Result c)] -> [(Entity, Bool, Result c)] forall a b. (a -> b) -> [a] -> [b] map (\(Entity a, Result c b) -> (Entity a, Bool True, Result c b)) ([(Entity, Result c)] -> [(Entity, Bool, Result c)]) -> IO [(Entity, Result c)] -> IO [(Entity, Bool, Result c)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, Result c)] tryGetComponents @c World world [ArchetypeId] archetypes queryTypes :: C c -> Set (TypeRep, TypeQuery) queryTypes C c _ = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c), TypeQuery CompQ) instance Queryable E Entity where runQueryEntity :: E -> World -> Entity -> IO (Maybe Entity) runQueryEntity E _ World _ Entity entity = Maybe Entity -> IO (Maybe Entity) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Entity -> IO (Maybe Entity)) -> Maybe Entity -> IO (Maybe Entity) forall a b. (a -> b) -> a -> b $ Entity -> Maybe Entity forall a. a -> Maybe a Just Entity entity runQueryInternal :: E -> [ArchetypeId] -> World -> IO [(Entity, Bool, Entity)] runQueryInternal E _ [ArchetypeId] archetypes World world = (Entity -> (Entity, Bool, Entity)) -> [Entity] -> [(Entity, Bool, Entity)] forall a b. (a -> b) -> [a] -> [b] map (\Entity x -> (Entity x, Bool True, Entity x)) ([Entity] -> [(Entity, Bool, Entity)]) -> IO [Entity] -> IO [(Entity, Bool, Entity)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> World -> [ArchetypeId] -> IO [Entity] tryGetEntities World world [ArchetypeId] archetypes queryTypes :: E -> Set (TypeRep, TypeQuery) queryTypes E _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty class RelQuery (exclusive :: Exclusivity) qd output | qd exclusive -> output where relRunQueryEntity :: qd -> World -> Entity -> IO (Maybe output) relRunQueryInternal :: qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relQueryTypes :: qd -> Set (TypeRep, TypeQuery) instance (Component c) => RelQuery Inclusive (R c Any) [Result (Rel c)] where relRunQueryEntity :: R c Any -> World -> Entity -> IO (Maybe [Result (Rel c)]) relRunQueryEntity R c Any _ World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c World world Entity entity return $ case res of Just (Just [Result (Rel c)] x) -> [Result (Rel c)] -> Maybe [Result (Rel c)] forall a. a -> Maybe a Just [Result (Rel c)] x Maybe (Maybe [Result (Rel c)]) _ -> Maybe [Result (Rel c)] forall a. Maybe a Nothing relRunQueryInternal :: R c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, [Result (Rel c)])] relRunQueryInternal R c Any _ [ArchetypeId] archetypes World world = ((Entity, [Result (Rel c)]) -> (Entity, Bool, [Result (Rel c)])) -> [(Entity, [Result (Rel c)])] -> [(Entity, Bool, [Result (Rel c)])] forall a b. (a -> b) -> [a] -> [b] map (\(Entity a, [Result (Rel c)] b) -> (Entity a, Bool True, [Result (Rel c)] b)) ([(Entity, [Result (Rel c)])] -> [(Entity, Bool, [Result (Rel c)])]) -> IO [(Entity, [Result (Rel c)])] -> IO [(Entity, Bool, [Result (Rel c)])] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, [Result (Rel c)])] tryGetRelCollections @c World world [ArchetypeId] archetypes relQueryTypes :: R c Any -> Set (TypeRep, TypeQuery) relQueryTypes R c Any _ = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (Proxy c -> TypeRep) -> Proxy c -> TypeRep forall a b. (a -> b) -> a -> b $ forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c, TypeQuery RelQ) instance (Component c) => RelQuery Exclusive (R c Any) (Result (Rel c)) where relRunQueryEntity :: R c Any -> World -> Entity -> IO (Maybe (Result (Rel c))) relRunQueryEntity R c Any _ World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c World world Entity entity return $ case res of Just (Just [Result (Rel c) x]) -> Result (Rel c) -> Maybe (Result (Rel c)) forall a. a -> Maybe a Just Result (Rel c) x Maybe (Maybe [Result (Rel c)]) _ -> Maybe (Result (Rel c)) forall a. Maybe a Nothing relRunQueryInternal :: R c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, Result (Rel c))] relRunQueryInternal R c Any _ [ArchetypeId] archetypes World world = do rels <- forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, [Result (Rel c)])] tryGetRelCollections @c World world [ArchetypeId] archetypes return $ map (\(Entity e, Result (Rel c) x : [Result (Rel c)] _) -> (Entity e, Bool True, Result (Rel c) x)) rels relQueryTypes :: R c Any -> Set (TypeRep, TypeQuery) relQueryTypes R c Any _ = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (Proxy c -> TypeRep) -> Proxy c -> TypeRep forall a b. (a -> b) -> a -> b $ forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c, TypeQuery RelQ) instance (Component c, Queryable q out) => RelQuery Inclusive (R c (Q q)) [out] where relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe [out]) relRunQueryEntity (R (Q q q)) World world Entity entity = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @Inclusive (forall {k} (a :: k) b. b -> R a b forall a b. b -> R a b R @c Any Any) World world Entity entity case fmap (traverse $ \Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) res of Maybe (IO [Maybe out]) Nothing -> Maybe [out] -> IO (Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe [out] forall a. Maybe a Nothing Just IO [Maybe out] x -> do x <- IO [Maybe out] x pure $ case catMaybes x of [] -> Maybe [out] forall a. Maybe a Nothing [out] x -> [out] -> Maybe [out] forall a. a -> Maybe a Just [out] x relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, [out])] relRunQueryInternal (R (Q q q)) [ArchetypeId] archetypes World world = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Inclusive (forall {k} (a :: k) b. b -> R a b forall a b. b -> R a b R @c Any Any) [ArchetypeId] archetypes World world for res $ \(Entity e, Bool b, [Result (Rel c)] rels) -> do a <- [Maybe out] -> [out] forall a. [Maybe a] -> [a] catMaybes ([Maybe out] -> [out]) -> IO [Maybe out] -> IO [out] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ((Result (Rel c) -> IO (Maybe out)) -> [Result (Rel c)] -> IO [Maybe out] forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> [a] -> f [b] traverse ((Result (Rel c) -> IO (Maybe out)) -> [Result (Rel c)] -> IO [Maybe out]) -> (Result (Rel c) -> IO (Maybe out)) -> [Result (Rel c)] -> IO [Maybe out] forall a b. (a -> b) -> a -> b $ \Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) [Result (Rel c)] rels pure $ case a of [] -> (Entity e, Bool False, [out] forall a. HasCallStack => a undefined) [out] x -> (Entity e, Bool b, [out] x) relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) relQueryTypes R c (Q q) _ = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (Proxy c -> TypeRep) -> Proxy c -> TypeRep forall a b. (a -> b) -> a -> b $ forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c, TypeQuery RelQ) instance (Component c, Queryable q out) => RelQuery Exclusive (R c (Q q)) out where relRunQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) relRunQueryEntity (R (Q q q)) World world Entity entity = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @Exclusive (forall {k} (a :: k) b. b -> R a b forall a b. b -> R a b R @c Any Any) World world Entity entity case fmap (\Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) res of Maybe (IO (Maybe out)) Nothing -> Maybe out -> IO (Maybe out) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe out forall a. Maybe a Nothing Just IO (Maybe out) x -> IO (Maybe out) x relRunQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] relRunQueryInternal (R (Q q q)) [ArchetypeId] archetypes World world = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Exclusive (forall {k} (a :: k) b. b -> R a b forall a b. b -> R a b R @c Any Any) [ArchetypeId] archetypes World world for res $ \(Entity e, Bool b, Result (Rel c) rels) -> do r <- (\Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) Result (Rel c) rels pure $ case r of Maybe out Nothing -> (Entity e, Bool False, out forall a. HasCallStack => a undefined) Just out x -> (Entity e, Bool b, out x) relQueryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) relQueryTypes R c (Q q) _ = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (Proxy c -> TypeRep) -> Proxy c -> TypeRep forall a b. (a -> b) -> a -> b $ forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c, TypeQuery RelQ) instance (Component c) => Queryable (R c Entity) (Result (Rel c)) where runQueryEntity :: R c Entity -> World -> Entity -> IO (Maybe (Result (Rel c))) runQueryEntity (R Entity target) World world Entity entity = do res <- forall c. Component c => Entity -> World -> Entity -> IO (Maybe (Maybe c)) tryGetEntityRel @c Entity target World world Entity entity return $ case res of Just (Just c x) -> Result (Rel c) -> Maybe (Result (Rel c)) forall a. a -> Maybe a Just (Result (Rel c) -> Maybe (Result (Rel c))) -> Result (Rel c) -> Maybe (Result (Rel c)) forall a b. (a -> b) -> a -> b $ (Rel c, Entity) -> Result (Rel c) forall c. (c, Entity) -> Result c Result (c -> Entity -> Rel c forall c. c -> Entity -> Rel c Rel c x Entity target, Entity entity) Maybe (Maybe c) _ -> Maybe (Result (Rel c)) forall a. Maybe a Nothing runQueryInternal :: R c Entity -> [ArchetypeId] -> World -> IO [(Entity, Bool, Result (Rel c))] runQueryInternal (R Entity target) [ArchetypeId] archetypes World world = ((Entity, Result (Rel c)) -> (Entity, Bool, Result (Rel c))) -> [(Entity, Result (Rel c))] -> [(Entity, Bool, Result (Rel c))] forall a b. (a -> b) -> [a] -> [b] map (\(Entity a, Result (Rel c) b) -> (Entity a, Bool True, Result (Rel c) b)) ([(Entity, Result (Rel c))] -> [(Entity, Bool, Result (Rel c))]) -> IO [(Entity, Result (Rel c))] -> IO [(Entity, Bool, Result (Rel c))] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall c. Component c => Entity -> World -> [ArchetypeId] -> IO [(Entity, Result (Rel c))] tryGetRels @c Entity target World world [ArchetypeId] archetypes queryTypes :: R c Entity -> Set (TypeRep, TypeQuery) queryTypes (R Entity target) = (TypeRep, TypeQuery) -> Set (TypeRep, TypeQuery) forall a. a -> Set a Set.singleton (Proxy c -> TypeRep forall {k} (proxy :: k -> *) (a :: k). Typeable a => proxy a -> TypeRep typeRep (Proxy c -> TypeRep) -> Proxy c -> TypeRep forall a b. (a -> b) -> a -> b $ forall t. Proxy t forall {k} (t :: k). Proxy t Proxy @c, Entity -> TypeQuery RelQ' Entity target) instance (RelQuery (RelExclusivity c) (R c Any) out) => Queryable (R c Any) out where runQueryEntity :: R c Any -> World -> Entity -> IO (Maybe out) runQueryEntity = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @(RelExclusivity c) runQueryInternal :: R c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] runQueryInternal = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @(RelExclusivity c) queryTypes :: R c Any -> Set (TypeRep, TypeQuery) queryTypes = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> Set (TypeRep, TypeQuery) relQueryTypes @(RelExclusivity c) instance (RelQuery (RelExclusivity c) (R c (Q q)) out) => Queryable (R c (Q q)) out where runQueryEntity :: R c (Q q) -> World -> Entity -> IO (Maybe out) runQueryEntity = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @(RelExclusivity c) runQueryInternal :: R c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] runQueryInternal = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @(RelExclusivity c) queryTypes :: R c (Q q) -> Set (TypeRep, TypeQuery) queryTypes = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> Set (TypeRep, TypeQuery) relQueryTypes @(RelExclusivity c) instance (RelQuery Inclusive (R c e) out) => Queryable (R' c e) out where runQueryEntity :: R' c e -> World -> Entity -> IO (Maybe out) runQueryEntity (R' e e) = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @Inclusive (forall (a :: k) b. b -> R a b forall {k} (a :: k) b. b -> R a b R @c e e) runQueryInternal :: R' c e -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] runQueryInternal (R' e e) = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Inclusive (forall (a :: k) b. b -> R a b forall {k} (a :: k) b. b -> R a b R @c e e) queryTypes :: R' c e -> Set (TypeRep, TypeQuery) queryTypes (R' e e) = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> Set (TypeRep, TypeQuery) relQueryTypes @Inclusive (forall (a :: k) b. b -> R a b forall {k} (a :: k) b. b -> R a b R @c e e) instance (Component c) => Queryable (M c) (Maybe (Result c)) where runQueryEntity :: M c -> World -> Entity -> IO (Maybe (Maybe (Result c))) runQueryEntity M c _ World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe c)) tryGetEntityComponent @c World world Entity entity case res of Maybe (Maybe c) Nothing -> Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c))) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe (Maybe (Result c)) forall a. Maybe a Nothing Just Maybe c Nothing -> Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c))) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c)))) -> Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c))) forall a b. (a -> b) -> a -> b $ Maybe (Result c) -> Maybe (Maybe (Result c)) forall a. a -> Maybe a Just Maybe (Result c) forall a. Maybe a Nothing Just (Just c x) -> Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c))) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c)))) -> Maybe (Maybe (Result c)) -> IO (Maybe (Maybe (Result c))) forall a b. (a -> b) -> a -> b $ Maybe (Result c) -> Maybe (Maybe (Result c)) forall a. a -> Maybe a Just (Maybe (Result c) -> Maybe (Maybe (Result c))) -> Maybe (Result c) -> Maybe (Maybe (Result c)) forall a b. (a -> b) -> a -> b $ Result c -> Maybe (Result c) forall a. a -> Maybe a Just (Result c -> Maybe (Result c)) -> Result c -> Maybe (Result c) forall a b. (a -> b) -> a -> b $ (c, Entity) -> Result c forall c. (c, Entity) -> Result c Result (c x, Entity entity) runQueryInternal :: M c -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (Result c))] runQueryInternal M c _ [ArchetypeId] archetypes World world = ((Entity, Maybe (Result c)) -> (Entity, Bool, Maybe (Result c))) -> [(Entity, Maybe (Result c))] -> [(Entity, Bool, Maybe (Result c))] forall a b. (a -> b) -> [a] -> [b] map (\(Entity a, Maybe (Result c) b) -> (Entity a, Bool True, Maybe (Result c) b)) ([(Entity, Maybe (Result c))] -> [(Entity, Bool, Maybe (Result c))]) -> IO [(Entity, Maybe (Result c))] -> IO [(Entity, Bool, Maybe (Result c))] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, Maybe (Result c))] tryGetComponentsMaybe @c World world [ArchetypeId] archetypes queryTypes :: M c -> Set (TypeRep, TypeQuery) queryTypes M c _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => Queryable (MR c Entity) (Maybe (Result (Rel c))) where runQueryEntity :: MR c Entity -> World -> Entity -> IO (Maybe (Maybe (Result (Rel c)))) runQueryEntity (MR Entity target) World world Entity entity = do res <- forall c. Component c => Entity -> World -> Entity -> IO (Maybe (Maybe c)) tryGetEntityRel @c Entity target World world Entity entity return $ case res of Maybe (Maybe c) Nothing -> Maybe (Maybe (Result (Rel c))) forall a. Maybe a Nothing Just Maybe c Nothing -> Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c))) forall a. a -> Maybe a Just Maybe (Result (Rel c)) forall a. Maybe a Nothing Just (Just c x) -> Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c))) forall a. a -> Maybe a Just (Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c)))) -> Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c))) forall a b. (a -> b) -> a -> b $ Result (Rel c) -> Maybe (Result (Rel c)) forall a. a -> Maybe a Just ((Rel c, Entity) -> Result (Rel c) forall c. (c, Entity) -> Result c Result (c -> Entity -> Rel c forall c. c -> Entity -> Rel c Rel c x Entity target, Entity entity)) runQueryInternal :: MR c Entity -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (Result (Rel c)))] runQueryInternal (MR Entity target) [ArchetypeId] archetypes World world = ((Entity, Maybe (Result (Rel c))) -> (Entity, Bool, Maybe (Result (Rel c)))) -> [(Entity, Maybe (Result (Rel c)))] -> [(Entity, Bool, Maybe (Result (Rel c)))] forall a b. (a -> b) -> [a] -> [b] map (\(Entity a, Maybe (Result (Rel c)) b) -> (Entity a, Bool True, Maybe (Result (Rel c)) b)) ([(Entity, Maybe (Result (Rel c)))] -> [(Entity, Bool, Maybe (Result (Rel c)))]) -> IO [(Entity, Maybe (Result (Rel c)))] -> IO [(Entity, Bool, Maybe (Result (Rel c)))] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall c. Component c => Entity -> World -> [ArchetypeId] -> IO [(Entity, Maybe (Result (Rel c)))] tryGetRelsMaybe @c Entity target World world [ArchetypeId] archetypes queryTypes :: MR c Entity -> Set (TypeRep, TypeQuery) queryTypes MR c Entity _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => RelQuery Inclusive (MR c Any) (Maybe [Result (Rel c)]) where relRunQueryEntity :: MR c Any -> World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) relRunQueryEntity MR c Any _ = forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c relRunQueryInternal :: MR c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [Result (Rel c)])] relRunQueryInternal MR c Any _ [ArchetypeId] archetypes World world = do x <- forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, [Result (Rel c)])] tryGetRelCollections @c World world [ArchetypeId] archetypes return $ flip map x $ \(Entity e, [Result (Rel c)] x) -> case [Result (Rel c)] x of [] -> (Entity e, Bool True, Maybe [Result (Rel c)] forall a. Maybe a Nothing) [Result (Rel c)] x -> (Entity e, Bool True, [Result (Rel c)] -> Maybe [Result (Rel c)] forall a. a -> Maybe a Just [Result (Rel c)] x) relQueryTypes :: MR c Any -> Set (TypeRep, TypeQuery) relQueryTypes MR c Any _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => RelQuery Exclusive (MR c Any) (Maybe (Result (Rel c))) where relRunQueryEntity :: MR c Any -> World -> Entity -> IO (Maybe (Maybe (Result (Rel c)))) relRunQueryEntity MR c Any _ World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c World world Entity entity pure $ case res of Just (Just [Result (Rel c) x]) -> Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c))) forall a. a -> Maybe a Just (Result (Rel c) -> Maybe (Result (Rel c)) forall a. a -> Maybe a Just Result (Rel c) x) Just (Just [Result (Rel c)] _) -> Maybe (Maybe (Result (Rel c))) forall a. HasCallStack => a undefined Just Maybe [Result (Rel c)] Nothing -> Maybe (Result (Rel c)) -> Maybe (Maybe (Result (Rel c))) forall a. a -> Maybe a Just Maybe (Result (Rel c)) forall a. Maybe a Nothing Maybe (Maybe [Result (Rel c)]) Nothing -> Maybe (Maybe (Result (Rel c))) forall a. Maybe a Nothing relRunQueryInternal :: MR c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (Result (Rel c)))] relRunQueryInternal MR c Any _ [ArchetypeId] archetypes World world = do x <- forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, [Result (Rel c)])] tryGetRelCollections @c World world [ArchetypeId] archetypes return $ flip map x $ \(Entity e, [Result (Rel c)] x) -> case [Result (Rel c)] x of [] -> (Entity e, Bool True, Maybe (Result (Rel c)) forall a. Maybe a Nothing) [Result (Rel c) x] -> (Entity e, Bool True, Result (Rel c) -> Maybe (Result (Rel c)) forall a. a -> Maybe a Just Result (Rel c) x) [Result (Rel c)] _ -> (Entity, Bool, Maybe (Result (Rel c))) forall a. HasCallStack => a undefined relQueryTypes :: MR c Any -> Set (TypeRep, TypeQuery) relQueryTypes MR c Any _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c, Queryable q out) => RelQuery Inclusive (MR c (Q q)) (Maybe [out]) where relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe [out])) relRunQueryEntity (MR (Q q q)) World world Entity entity = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @Inclusive (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Any Any) World world Entity entity case res of Maybe (Maybe [Result (Rel c)]) Nothing -> Maybe (Maybe [out]) -> IO (Maybe (Maybe [out])) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe (Maybe [out]) forall a. Maybe a Nothing Just Maybe [Result (Rel c)] Nothing -> Maybe (Maybe [out]) -> IO (Maybe (Maybe [out])) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe (Maybe [out]) -> IO (Maybe (Maybe [out]))) -> Maybe (Maybe [out]) -> IO (Maybe (Maybe [out])) forall a b. (a -> b) -> a -> b $ Maybe [out] -> Maybe (Maybe [out]) forall a. a -> Maybe a Just Maybe [out] forall a. Maybe a Nothing Just (Just [Result (Rel c)] r) -> Maybe [out] -> Maybe (Maybe [out]) forall a. a -> Maybe a Just (Maybe [out] -> Maybe (Maybe [out])) -> IO (Maybe [out]) -> IO (Maybe (Maybe [out])) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> do let targets :: [Entity] targets = (Result (Rel c) -> Entity) -> [Result (Rel c)] -> [Entity] forall a b. (a -> b) -> [a] -> [b] map (\Result (Rel c) x -> Result (Rel c) x.target) [Result (Rel c)] r results <- [Maybe out] -> [out] forall a. [Maybe a] -> [a] catMaybes ([Maybe out] -> [out]) -> IO [Maybe out] -> IO [out] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> [Entity] -> (Entity -> IO (Maybe out)) -> IO [Maybe out] forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) for [Entity] targets (q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world) case results of [] -> Maybe [out] -> IO (Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe [out] forall a. Maybe a Nothing [out] x -> Maybe [out] -> IO (Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe [out] -> IO (Maybe [out])) -> Maybe [out] -> IO (Maybe [out]) forall a b. (a -> b) -> a -> b $ [out] -> Maybe [out] forall a. a -> Maybe a Just [out] x relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe [out])] relRunQueryInternal (MR (Q q q)) [ArchetypeId] archetypes World world = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Inclusive (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Any Any) [ArchetypeId] archetypes World world for res $ \(Entity e, Bool b, Maybe [Result (Rel c)] r) -> do case Maybe [Result (Rel c)] r of Maybe [Result (Rel c)] Nothing -> (Entity, Bool, Maybe [out]) -> IO (Entity, Bool, Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Maybe [out] forall a. Maybe a Nothing) Just [Result (Rel c)] r -> do rs <- [Result (Rel c)] -> (Result (Rel c) -> IO (Maybe out)) -> IO [Maybe out] forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) for [Result (Rel c)] r (\Result (Rel c) x -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) x.target) case catMaybes rs of [] -> (Entity, Bool, Maybe [out]) -> IO (Entity, Bool, Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Maybe [out] forall a. Maybe a Nothing) [out] x -> (Entity, Bool, Maybe [out]) -> IO (Entity, Bool, Maybe [out]) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, [out] -> Maybe [out] forall a. a -> Maybe a Just [out] x) relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) relQueryTypes MR c (Q q) _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c, Queryable q out) => RelQuery Exclusive (MR c (Q q)) (Maybe out) where relRunQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe (Maybe out)) relRunQueryEntity (MR (Q q q)) World world Entity entity = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @Exclusive (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Any Any) World world Entity entity case res of Maybe (Maybe (Result (Rel c))) Nothing -> Maybe (Maybe out) -> IO (Maybe (Maybe out)) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe (Maybe out) forall a. Maybe a Nothing Just Maybe (Result (Rel c)) Nothing -> Maybe (Maybe out) -> IO (Maybe (Maybe out)) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe (Maybe out) -> IO (Maybe (Maybe out))) -> Maybe (Maybe out) -> IO (Maybe (Maybe out)) forall a b. (a -> b) -> a -> b $ Maybe out -> Maybe (Maybe out) forall a. a -> Maybe a Just Maybe out forall a. Maybe a Nothing Just (Just Result (Rel c) x) -> Maybe out -> Maybe (Maybe out) forall a. a -> Maybe a Just (Maybe out -> Maybe (Maybe out)) -> IO (Maybe out) -> IO (Maybe (Maybe out)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) x.target relRunQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe out)] relRunQueryInternal (MR (Q q q)) [ArchetypeId] archetypes World world = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Exclusive (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Any Any) [ArchetypeId] archetypes World world for res $ \(Entity e, Bool b, Maybe (Result (Rel c)) r) -> do case Maybe (Result (Rel c)) r of Maybe (Result (Rel c)) Nothing -> (Entity, Bool, Maybe out) -> IO (Entity, Bool, Maybe out) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Maybe out forall a. Maybe a Nothing) Just Result (Rel c) r -> do res <- q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target pure (e, b, res) relQueryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) relQueryTypes MR c (Q q) _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (RelQuery (RelExclusivity c) (MR c Any) out) => Queryable (MR c Any) out where runQueryEntity :: MR c Any -> World -> Entity -> IO (Maybe out) runQueryEntity = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @(RelExclusivity c) runQueryInternal :: MR c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] runQueryInternal = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @(RelExclusivity c) queryTypes :: MR c Any -> Set (TypeRep, TypeQuery) queryTypes MR c Any _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (RelQuery (RelExclusivity c) (MR c (Q q)) out) => Queryable (MR c (Q q)) out where runQueryEntity :: MR c (Q q) -> World -> Entity -> IO (Maybe out) runQueryEntity = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> World -> Entity -> IO (Maybe output) relRunQueryEntity @(RelExclusivity c) runQueryInternal :: MR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] runQueryInternal = forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @(RelExclusivity c) queryTypes :: MR c (Q q) -> Set (TypeRep, TypeQuery) queryTypes MR c (Q q) _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => Queryable (Has c) Bool where runQueryEntity :: Has c -> World -> Entity -> IO (Maybe Bool) runQueryEntity Has c _ World world Entity entity = do list <- M c -> World -> Entity -> IO (Maybe (Maybe (Result c))) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity (forall a. M a forall {k} (a :: k). M a M @c) World world Entity entity case list of Maybe (Maybe (Result c)) Nothing -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Bool forall a. Maybe a Nothing Just Maybe (Result c) x -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Maybe Bool -> IO (Maybe Bool)) -> Maybe Bool -> IO (Maybe Bool) forall a b. (a -> b) -> a -> b $ Bool -> Maybe Bool forall a. a -> Maybe a Just (Maybe (Result c) -> Bool forall a. Maybe a -> Bool isJust Maybe (Result c) x) runQueryInternal :: Has c -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] runQueryInternal Has c _ [ArchetypeId] archetypes World world = do list <- M c -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (Result c))] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal (forall a. M a forall {k} (a :: k). M a M @c) [ArchetypeId] archetypes World world return $ map (Data.Bifunctor.second isJust) list queryTypes :: Has c -> Set (TypeRep, TypeQuery) queryTypes Has c _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => Queryable (HasR c Any) Bool where runQueryEntity :: HasR c Any -> World -> Entity -> IO (Maybe Bool) runQueryEntity HasR c Any _ World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c World world Entity entity return $ case res of Maybe (Maybe [Result (Rel c)]) Nothing -> Maybe Bool forall a. Maybe a Nothing Just Maybe [Result (Rel c)] Nothing -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool False Just (Just [Result (Rel c)] _) -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool True runQueryInternal :: HasR c Any -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] runQueryInternal HasR c Any _ [ArchetypeId] archetypes World world = do res <- forall c. Component c => World -> [ArchetypeId] -> IO [(Entity, [Result (Rel c)])] tryGetRelCollections @c World world [ArchetypeId] archetypes return $ map ((\(Entity a, Bool b) -> (Entity a, Bool True, Bool b)) . Data.Bifunctor.second null) res queryTypes :: HasR c Any -> Set (TypeRep, TypeQuery) queryTypes HasR c Any _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c) => Queryable (HasR c Entity) Bool where runQueryEntity :: HasR c Entity -> World -> Entity -> IO (Maybe Bool) runQueryEntity (HasR Entity target) World world Entity entity = do res <- forall c. Component c => Entity -> World -> Entity -> IO (Maybe (Maybe c)) tryGetEntityRel @c Entity target World world Entity entity return $ case res of Maybe (Maybe c) Nothing -> Maybe Bool forall a. Maybe a Nothing Just Maybe c Nothing -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool False Just (Just c _) -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool True runQueryInternal :: HasR c Entity -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] runQueryInternal (HasR Entity target) [ArchetypeId] archetypes World world = do res <- MR c Entity -> [ArchetypeId] -> World -> IO [(Entity, Bool, Maybe (Result (Rel c)))] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Entity target) [ArchetypeId] archetypes World world return $ map (Data.Bifunctor.second isNothing) res queryTypes :: HasR c Entity -> Set (TypeRep, TypeQuery) queryTypes HasR c Entity _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Component c, Queryable q out) => Queryable (HasR c (Q q)) Bool where runQueryEntity :: HasR c (Q q) -> World -> Entity -> IO (Maybe Bool) runQueryEntity (HasR (Q q q)) World world Entity entity = do res <- forall c. Component c => World -> Entity -> IO (Maybe (Maybe [Result (Rel c)])) tryGetEntityRelCollection @c World world Entity entity case res of Maybe (Maybe [Result (Rel c)]) Nothing -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure Maybe Bool forall a. Maybe a Nothing Just Maybe [Result (Rel c)] Nothing -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe Bool -> IO (Maybe Bool)) -> Maybe Bool -> IO (Maybe Bool) forall a b. (a -> b) -> a -> b $ Bool -> Maybe Bool forall a. a -> Maybe a Just Bool False Just (Just [Result (Rel c)] r) -> do res <- [Maybe out] -> [out] forall a. [Maybe a] -> [a] catMaybes ([Maybe out] -> [out]) -> IO [Maybe out] -> IO [out] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> [Result (Rel c)] -> (Result (Rel c) -> IO (Maybe out)) -> IO [Maybe out] forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) for [Result (Rel c)] r (\Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) case res of [] -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe Bool -> IO (Maybe Bool)) -> Maybe Bool -> IO (Maybe Bool) forall a b. (a -> b) -> a -> b $ Bool -> Maybe Bool forall a. a -> Maybe a Just Bool False [out] _ -> Maybe Bool -> IO (Maybe Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Maybe Bool -> IO (Maybe Bool)) -> Maybe Bool -> IO (Maybe Bool) forall a b. (a -> b) -> a -> b $ Bool -> Maybe Bool forall a. a -> Maybe a Just Bool True runQueryInternal :: HasR c (Q q) -> [ArchetypeId] -> World -> IO [(Entity, Bool, Bool)] runQueryInternal (HasR (Q q q)) [ArchetypeId] archetypes World world = do res <- forall (exclusive :: Exclusivity) qd output. RelQuery exclusive qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] relRunQueryInternal @Inclusive (forall {k} (a :: k) b. b -> MR a b forall a b. b -> MR a b MR @c Any Any) [ArchetypeId] archetypes World world for res $ \(Entity e, Bool b, Maybe [Result (Rel c)] r) -> do case Maybe [Result (Rel c)] r of Maybe [Result (Rel c)] Nothing -> (Entity, Bool, Bool) -> IO (Entity, Bool, Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Bool False) Just [Result (Rel c)] r -> do res <- [Maybe out] -> [out] forall a. [Maybe a] -> [a] catMaybes ([Maybe out] -> [out]) -> IO [Maybe out] -> IO [out] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> [Result (Rel c)] -> (Result (Rel c) -> IO (Maybe out)) -> IO [Maybe out] forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) for [Result (Rel c)] r (\Result (Rel c) r -> q -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q q World world Result (Rel c) r.target) case res of [] -> (Entity, Bool, Bool) -> IO (Entity, Bool, Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Bool False) [out] _ -> (Entity, Bool, Bool) -> IO (Entity, Bool, Bool) forall a. a -> IO a forall (f :: * -> *) a. Applicative f => a -> f a pure (Entity e, Bool b, Bool True) queryTypes :: HasR c (Q q) -> Set (TypeRep, TypeQuery) queryTypes HasR c (Q q) _ = Set (TypeRep, TypeQuery) forall a. Set a Set.empty instance (Queryable qd out, Mappable MapQueryVal out out') => Queryable (Val qd) out' where runQueryEntity :: Val qd -> World -> Entity -> IO (Maybe out') runQueryEntity (Val qd qd) World b Entity c = do x <- qd -> World -> Entity -> IO (Maybe out) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity qd qd World b Entity c return $ fmap (mapTuple @MapQueryVal) x runQueryInternal :: Val qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, out')] runQueryInternal (Val qd qd) [ArchetypeId] b World c = do x <- qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, out)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal qd qd [ArchetypeId] b World c return $ map (\(Entity a, Bool b, out c) -> (Entity a, Bool b, forall {k} (flag :: k) a b. Mappable flag a b => a -> b forall flag a b. Mappable flag a b => a -> b mapTuple @MapQueryVal out c)) x queryTypes :: Val qd -> Set (TypeRep, TypeQuery) queryTypes (Val qd qd) = qd -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes qd qd instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1) => Queryable (q0, q1) (o0, o1) where runQueryEntity :: (q0, q1) -> World -> Entity -> IO (Maybe (o0, o1)) runQueryEntity (q0 q0, q1 q1) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity return $ (,) <$> r0 <*> r1 runQueryInternal :: (q0, q1) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1))] runQueryInternal (q0 q0, q1 q1) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1, (o0 r0, o1 r1))) $ getZipList $ (,) <$> ZipList r0 <*> ZipList r1 queryTypes :: (q0, q1) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2) => Queryable (q0, q1, q2) (o0, o1, o2) where runQueryEntity :: (q0, q1, q2) -> World -> Entity -> IO (Maybe (o0, o1, o2)) runQueryEntity (q0 q0, q1 q1, q2 q2) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity return $ (,,) <$> r0 <*> r1 <*> r2 runQueryInternal :: (q0, q1, q2) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2))] runQueryInternal (q0 q0, q1 q1, q2 q2) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2, (o0 r0, o1 r1, o2 r2))) $ getZipList $ (,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 queryTypes :: (q0, q1, q2) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3) => Queryable (q0, q1, q2, q3) (o0, o1, o2, o3) where runQueryEntity :: (q0, q1, q2, q3) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity return $ (,,,) <$> r0 <*> r1 <*> r2 <*> r3 runQueryInternal :: (q0, q1, q2, q3) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3, (o0 r0, o1 r1, o2 r2, o3 r3))) $ getZipList $ (,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 queryTypes :: (q0, q1, q2, q3) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4) => Queryable (q0, q1, q2, q3, q4) (o0, o1, o2, o3, o4) where runQueryEntity :: (q0, q1, q2, q3, q4) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity return $ (,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 runQueryInternal :: (q0, q1, q2, q3, q4) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4))) $ getZipList $ (,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 queryTypes :: (q0, q1, q2, q3, q4) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5) => Queryable (q0, q1, q2, q3, q4, q5) (o0, o1, o2, o3, o4, o5) where runQueryEntity :: (q0, q1, q2, q3, q4, q5) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity return $ (,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 runQueryInternal :: (q0, q1, q2, q3, q4, q5) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5))) $ getZipList $ (,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 queryTypes :: (q0, q1, q2, q3, q4, q5) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6) => Queryable (q0, q1, q2, q3, q4, q5, q6) (o0, o1, o2, o3, o4, o5, o6) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity return $ (,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6))) $ getZipList $ (,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 queryTypes :: (q0, q1, q2, q3, q4, q5, q6) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7) (o0, o1, o2, o3, o4, o5, o6, o7) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity return $ (,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7))) $ getZipList $ (,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8) (o0, o1, o2, o3, o4, o5, o6, o7, o8) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity return $ (,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8))) $ getZipList $ (,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity return $ (,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9))) $ getZipList $ (,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity r10 <- runQueryEntity q10 world entity return $ (,,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 <*> r10 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world r10 <- runQueryInternal q10 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9), (Entity _, Bool b10, o10 r10)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9 Bool -> Bool -> Bool || Bool b10, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9, o10 r10))) $ getZipList $ (,,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 <*> ZipList r10 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9, q10 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q10 q10] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity r10 <- runQueryEntity q10 world entity r11 <- runQueryEntity q11 world entity return $ (,,,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 <*> r10 <*> r11 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world r10 <- runQueryInternal q10 archetypes world r11 <- runQueryInternal q11 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9), (Entity _, Bool b10, o10 r10), (Entity _, Bool b11, o11 r11)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9 Bool -> Bool -> Bool || Bool b10 Bool -> Bool -> Bool || Bool b11, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9, o10 r10, o11 r11))) $ getZipList $ (,,,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 <*> ZipList r10 <*> ZipList r11 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9, q10 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q10 q10, q11 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q11 q11] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity r10 <- runQueryEntity q10 world entity r11 <- runQueryEntity q11 world entity r12 <- runQueryEntity q12 world entity return $ (,,,,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 <*> r10 <*> r11 <*> r12 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world r10 <- runQueryInternal q10 archetypes world r11 <- runQueryInternal q11 archetypes world r12 <- runQueryInternal q12 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9), (Entity _, Bool b10, o10 r10), (Entity _, Bool b11, o11 r11), (Entity _, Bool b12, o12 r12)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9 Bool -> Bool -> Bool || Bool b10 Bool -> Bool -> Bool || Bool b11 Bool -> Bool -> Bool || Bool b12, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9, o10 r10, o11 r11, o12 r12))) $ getZipList $ (,,,,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 <*> ZipList r10 <*> ZipList r11 <*> ZipList r12 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9, q10 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q10 q10, q11 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q11 q11, q12 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q12 q12] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12, Queryable q13 o13) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity r10 <- runQueryEntity q10 world entity r11 <- runQueryEntity q11 world entity r12 <- runQueryEntity q12 world entity r13 <- runQueryEntity q13 world entity return $ (,,,,,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 <*> r10 <*> r11 <*> r12 <*> r13 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world r10 <- runQueryInternal q10 archetypes world r11 <- runQueryInternal q11 archetypes world r12 <- runQueryInternal q12 archetypes world r13 <- runQueryInternal q13 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9), (Entity _, Bool b10, o10 r10), (Entity _, Bool b11, o11 r11), (Entity _, Bool b12, o12 r12), (Entity _, Bool b13, o13 r13)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9 Bool -> Bool -> Bool || Bool b10 Bool -> Bool -> Bool || Bool b11 Bool -> Bool -> Bool || Bool b12 Bool -> Bool -> Bool || Bool b13, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9, o10 r10, o11 r11, o12 r12, o13 r13))) $ getZipList $ (,,,,,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 <*> ZipList r10 <*> ZipList r11 <*> ZipList r12 <*> ZipList r13 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9, q10 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q10 q10, q11 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q11 q11, q12 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q12 q12, q13 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q13 q13] instance {-# OVERLAPPING #-} (Queryable q0 o0, Queryable q1 o1, Queryable q2 o2, Queryable q3 o3, Queryable q4 o4, Queryable q5 o5, Queryable q6 o6, Queryable q7 o7, Queryable q8 o8, Queryable q9 o9, Queryable q10 o10, Queryable q11 o11, Queryable q12 o12, Queryable q13 o13, Queryable q14 o14) => Queryable (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14) where runQueryEntity :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> World -> Entity -> IO (Maybe (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14)) runQueryEntity (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13, q14 q14) World world Entity entity = do r0 <- q0 -> World -> Entity -> IO (Maybe o0) forall qd output. Queryable qd output => qd -> World -> Entity -> IO (Maybe output) runQueryEntity q0 q0 World world Entity entity r1 <- runQueryEntity q1 world entity r2 <- runQueryEntity q2 world entity r3 <- runQueryEntity q3 world entity r4 <- runQueryEntity q4 world entity r5 <- runQueryEntity q5 world entity r6 <- runQueryEntity q6 world entity r7 <- runQueryEntity q7 world entity r8 <- runQueryEntity q8 world entity r9 <- runQueryEntity q9 world entity r10 <- runQueryEntity q10 world entity r11 <- runQueryEntity q11 world entity r12 <- runQueryEntity q12 world entity r13 <- runQueryEntity q13 world entity r14 <- runQueryEntity q14 world entity return $ (,,,,,,,,,,,,,,) <$> r0 <*> r1 <*> r2 <*> r3 <*> r4 <*> r5 <*> r6 <*> r7 <*> r8 <*> r9 <*> r10 <*> r11 <*> r12 <*> r13 <*> r14 runQueryInternal :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> [ArchetypeId] -> World -> IO [(Entity, Bool, (o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14))] runQueryInternal (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13, q14 q14) [ArchetypeId] archetypes World world = do r0 <- q0 -> [ArchetypeId] -> World -> IO [(Entity, Bool, o0)] forall qd output. Queryable qd output => qd -> [ArchetypeId] -> World -> IO [(Entity, Bool, output)] runQueryInternal q0 q0 [ArchetypeId] archetypes World world r1 <- runQueryInternal q1 archetypes world r2 <- runQueryInternal q2 archetypes world r3 <- runQueryInternal q3 archetypes world r4 <- runQueryInternal q4 archetypes world r5 <- runQueryInternal q5 archetypes world r6 <- runQueryInternal q6 archetypes world r7 <- runQueryInternal q7 archetypes world r8 <- runQueryInternal q8 archetypes world r9 <- runQueryInternal q9 archetypes world r10 <- runQueryInternal q10 archetypes world r11 <- runQueryInternal q11 archetypes world r12 <- runQueryInternal q12 archetypes world r13 <- runQueryInternal q13 archetypes world r14 <- runQueryInternal q14 archetypes world return $ map (\((Entity e0, Bool b0, o0 r0), (Entity _, Bool b1, o1 r1), (Entity _, Bool b2, o2 r2), (Entity _, Bool b3, o3 r3), (Entity _, Bool b4, o4 r4), (Entity _, Bool b5, o5 r5), (Entity _, Bool b6, o6 r6), (Entity _, Bool b7, o7 r7), (Entity _, Bool b8, o8 r8), (Entity _, Bool b9, o9 r9), (Entity _, Bool b10, o10 r10), (Entity _, Bool b11, o11 r11), (Entity _, Bool b12, o12 r12), (Entity _, Bool b13, o13 r13), (Entity _, Bool b14, o14 r14)) -> (Entity e0, Bool b0 Bool -> Bool -> Bool || Bool b1 Bool -> Bool -> Bool || Bool b2 Bool -> Bool -> Bool || Bool b3 Bool -> Bool -> Bool || Bool b4 Bool -> Bool -> Bool || Bool b5 Bool -> Bool -> Bool || Bool b6 Bool -> Bool -> Bool || Bool b7 Bool -> Bool -> Bool || Bool b8 Bool -> Bool -> Bool || Bool b9 Bool -> Bool -> Bool || Bool b10 Bool -> Bool -> Bool || Bool b11 Bool -> Bool -> Bool || Bool b12 Bool -> Bool -> Bool || Bool b13 Bool -> Bool -> Bool || Bool b14, (o0 r0, o1 r1, o2 r2, o3 r3, o4 r4, o5 r5, o6 r6, o7 r7, o8 r8, o9 r9, o10 r10, o11 r11, o12 r12, o13 r13, o14 r14))) $ getZipList $ (,,,,,,,,,,,,,,) <$> ZipList r0 <*> ZipList r1 <*> ZipList r2 <*> ZipList r3 <*> ZipList r4 <*> ZipList r5 <*> ZipList r6 <*> ZipList r7 <*> ZipList r8 <*> ZipList r9 <*> ZipList r10 <*> ZipList r11 <*> ZipList r12 <*> ZipList r13 <*> ZipList r14 queryTypes :: (q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14) -> Set (TypeRep, TypeQuery) queryTypes (q0 q0, q1 q1, q2 q2, q3 q3, q4 q4, q5 q5, q6 q6, q7 q7, q8 q8, q9 q9, q10 q10, q11 q11, q12 q12, q13 q13, q14 q14) = [Set (TypeRep, TypeQuery)] -> Set (TypeRep, TypeQuery) forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a Set.unions [q0 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q0 q0, q1 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q1 q1, q2 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q2 q2, q3 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q3 q3, q4 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q4 q4, q5 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q5 q5, q6 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q6 q6, q7 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q7 q7, q8 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q8 q8, q9 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q9 q9, q10 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q10 q10, q11 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q11 q11, q12 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q12 q12, q13 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q13 q13, q14 -> Set (TypeRep, TypeQuery) forall qd output. Queryable qd output => qd -> Set (TypeRep, TypeQuery) queryTypes q14 q14]