{-# 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 = forall a. a -> Identity a
Identity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 = forall a. a -> Identity a
Identity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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) = 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 Elem s
x) = 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) = 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) = forall (m :: * -> *) s. ExplDestroy m s => s -> Int -> m ()
explDestroy s
s