{-# OPTIONS_GHC -Wno-orphans #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Apecs.Components where
import Data.Functor.Identity
import Apecs.Core
import qualified Apecs.THTuples as T
instance Component c => Component (Identity c) where
type Storage (Identity c) = Identity (Storage c)
instance Has w m c => Has w m (Identity c) where
{-# INLINE getStore #-}
getStore :: SystemT w m (Storage (Identity c))
getStore = Storage c -> Identity (Storage c)
forall a. a -> Identity a
Identity (Storage c -> Identity (Storage c))
-> SystemT w m (Storage c) -> SystemT w m (Identity (Storage c))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SystemT w m (Storage c)
forall w (m :: * -> *) c. Has w m c => SystemT w m (Storage c)
getStore
type instance Elem (Identity s) = Identity (Elem s)
instance ExplGet m s => ExplGet m (Identity s) where
{-# INLINE explGet #-}
explGet :: Identity s -> Int -> m (Elem (Identity s))
explGet (Identity s
s) Int
e = Elem s -> Identity (Elem s)
forall a. a -> Identity a
Identity (Elem s -> Identity (Elem s))
-> m (Elem s) -> m (Identity (Elem s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> s -> Int -> m (Elem s)
forall (m :: * -> *) s. ExplGet m s => s -> Int -> m (Elem s)
explGet s
s Int
e
{-# INLINE explExists #-}
explExists :: Identity s -> Int -> m Bool
explExists (Identity s
s) = s -> Int -> m Bool
forall (m :: * -> *) s. ExplGet m s => s -> Int -> m Bool
explExists s
s
instance ExplSet m s => ExplSet m (Identity s) where
{-# INLINE explSet #-}
explSet :: Identity s -> Int -> Elem (Identity s) -> m ()
explSet (Identity s
s) Int
e (Identity x) = s -> Int -> Elem s -> m ()
forall (m :: * -> *) s. ExplSet m s => s -> Int -> Elem s -> m ()
explSet s
s Int
e Elem s
x
instance ExplMembers m s => ExplMembers m (Identity s) where
{-# INLINE explMembers #-}
explMembers :: Identity s -> m (Vector Int)
explMembers (Identity s
s) = s -> m (Vector Int)
forall (m :: * -> *) s. ExplMembers m s => s -> m (Vector Int)
explMembers s
s
instance ExplDestroy m s => ExplDestroy m (Identity s) where
{-# INLINE explDestroy #-}
explDestroy :: Identity s -> Int -> m ()
explDestroy (Identity s
s) = s -> Int -> m ()
forall (m :: * -> *) s. ExplDestroy m s => s -> Int -> m ()
explDestroy s
s