packages feed

ecstasy 0.1.0.1 → 0.1.1.0

raw patch · 4 files changed

+55/−21 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Ecstasy: instance (GHC.Generics.Generic (world 'Data.Ecstasy.Types.SetterOf), GHC.Generics.Generic (world 'Data.Ecstasy.Types.WorldOf), GHC.Generics.Generic (world 'Data.Ecstasy.Types.FieldOf), Data.Ecstasy.Deriving.GSetEntity (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf)), Data.Ecstasy.Deriving.GGetEntity (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)), Data.Ecstasy.Deriving.GConvertSetter (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)), Data.Ecstasy.Deriving.GDefault (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)), Data.Ecstasy.Deriving.GDefault (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)), Data.Ecstasy.Deriving.GDefault (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf))) => Data.Ecstasy.HasWorld world
+ Data.Ecstasy: delEntity :: (HasWorld world, Generic (world 'SetterOf), GDefault 'False (Rep (world 'SetterOf))) => world 'SetterOf
+ Data.Ecstasy: deleteEntity :: (HasWorld world, Monad m) => Ent -> SystemT world m ()
+ Data.Ecstasy: instance (GHC.Generics.Generic (world 'Data.Ecstasy.Types.SetterOf), GHC.Generics.Generic (world 'Data.Ecstasy.Types.WorldOf), GHC.Generics.Generic (world 'Data.Ecstasy.Types.FieldOf), Data.Ecstasy.Deriving.GSetEntity (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf)), Data.Ecstasy.Deriving.GGetEntity (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)), Data.Ecstasy.Deriving.GConvertSetter (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)) (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)), Data.Ecstasy.Deriving.GDefault 'GHC.Types.True (GHC.Generics.Rep (world 'Data.Ecstasy.Types.FieldOf)), Data.Ecstasy.Deriving.GDefault 'GHC.Types.False (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)), Data.Ecstasy.Deriving.GDefault 'GHC.Types.True (GHC.Generics.Rep (world 'Data.Ecstasy.Types.SetterOf)), Data.Ecstasy.Deriving.GDefault 'GHC.Types.True (GHC.Generics.Rep (world 'Data.Ecstasy.Types.WorldOf))) => Data.Ecstasy.HasWorld world
- Data.Ecstasy: defEntity :: (HasWorld world, Generic (world 'FieldOf), GDefault (Rep (world 'FieldOf))) => world 'FieldOf
+ Data.Ecstasy: defEntity :: (HasWorld world, Generic (world 'FieldOf), GDefault 'True (Rep (world 'FieldOf))) => world 'FieldOf
- Data.Ecstasy: defEntity' :: (HasWorld world, Generic (world 'SetterOf), GDefault (Rep (world 'SetterOf))) => world 'SetterOf
+ Data.Ecstasy: defEntity' :: (HasWorld world, Generic (world 'SetterOf), GDefault 'True (Rep (world 'SetterOf))) => world 'SetterOf
- Data.Ecstasy: defWorld :: (HasWorld world, Generic (world 'WorldOf), GDefault (Rep (world 'WorldOf))) => world 'WorldOf
+ Data.Ecstasy: defWorld :: (HasWorld world, Generic (world 'WorldOf), GDefault 'True (Rep (world 'WorldOf))) => world 'WorldOf

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for ecstasy +## 0.1.1.0  -- 2018-02-18++* Added 'deleteEntity' (function) and 'delEntity' (QueryT setter).+ ## 0.1.0.1  -- 2018-02-14  * Added 'yieldSystemT' for resuming a 'SystemT' computation later.
ecstasy.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                ecstasy-version:             0.1.0.1+version:             0.1.1.0 synopsis:   A GHC.Generics based entity component system. 
src/Data/Ecstasy.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleContexts     #-} {-# LANGUAGE FlexibleInstances    #-} {-# LANGUAGE TupleSections        #-}+{-# LANGUAGE TypeApplications     #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ViewPatterns         #-} @@ -98,30 +99,40 @@   defEntity :: world 'FieldOf   default defEntity       :: ( Generic (world 'FieldOf)-         , GDefault (Rep (world 'FieldOf))+         , GDefault 'True (Rep (world 'FieldOf))          )       => world 'FieldOf-  defEntity = def+  defEntity = def @'True    ----------------------------------------------------------------------------   -- | The default setter, which keeps all components with their previous value.   defEntity' :: world 'SetterOf   default defEntity'       :: ( Generic (world 'SetterOf)-         , GDefault (Rep (world 'SetterOf))+         , GDefault 'True (Rep (world 'SetterOf))          )       => world 'SetterOf-  defEntity' = def+  defEntity' = def @'True    ----------------------------------------------------------------------------+  -- | A setter which will delete the entity if its 'QueryT' matches.+  delEntity :: world 'SetterOf+  default delEntity+      :: ( Generic (world 'SetterOf)+         , GDefault 'False (Rep (world 'SetterOf))+         )+      => world 'SetterOf+  delEntity = def @'False++  ----------------------------------------------------------------------------   -- | The default world, which contains only empty containers.   defWorld :: world 'WorldOf   default defWorld       :: ( Generic (world 'WorldOf)-         , GDefault (Rep (world 'WorldOf))+         , GDefault 'True (Rep (world 'WorldOf))          )       => world 'WorldOf-  defWorld = def+  defWorld = def @'True   instance ( Generic (world 'SetterOf)@@ -133,9 +144,10 @@                       (Rep (world 'FieldOf))          , GConvertSetter (Rep (world 'FieldOf))                           (Rep (world 'SetterOf))-         , GDefault (Rep (world 'FieldOf))-         , GDefault (Rep (world 'SetterOf))-         , GDefault (Rep (world 'WorldOf))+         , GDefault 'True  (Rep (world 'FieldOf))+         , GDefault 'False (Rep (world 'SetterOf))+         , GDefault 'True  (Rep (world 'SetterOf))+         , GDefault 'True  (Rep (world 'WorldOf))          ) => HasWorld world  @@ -160,6 +172,15 @@   e <- nextEntity   setEntity e $ convertSetter cs   pure e+++------------------------------------------------------------------------------+-- | Delete an entity.+deleteEntity+    :: (HasWorld world, Monad m)+    => Ent+    -> SystemT world m ()+deleteEntity = flip setEntity delEntity   ------------------------------------------------------------------------------
src/Data/Ecstasy/Deriving.hs view
@@ -1,6 +1,11 @@+{-# LANGUAGE AllowAmbiguousTypes   #-}+{-# LANGUAGE DataKinds             #-} {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE FlexibleInstances     #-}+{-# LANGUAGE KindSignatures        #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables   #-}+{-# LANGUAGE TypeApplications      #-} {-# LANGUAGE TypeOperators         #-}  module Data.Ecstasy.Deriving where@@ -84,35 +89,39 @@   {-# INLINE gSetEntity #-}  -def :: (Generic a, GDefault (Rep a)) => a-def = to gdef+def :: forall keep a. (Generic a, GDefault keep (Rep a)) => a+def = to $ gdef @keep {-# INLINE def #-}  -class GDefault f where+class GDefault (keep :: Bool) f where   gdef :: f a -instance GDefault U1 where+instance GDefault keep U1 where   gdef = U1   {-# INLINE gdef #-} -instance GDefault (K1 i (Maybe c)) where+instance GDefault keep (K1 i (Maybe c)) where   gdef = K1 Nothing   {-# INLINE gdef #-} -instance GDefault (K1 i (Update c)) where+instance GDefault 'False (K1 i (Update c)) where+  gdef = K1 Unset+  {-# INLINE gdef #-}++instance GDefault 'True (K1 i (Update c)) where   gdef = K1 Keep   {-# INLINE gdef #-} -instance GDefault (K1 i (IntMap c)) where+instance GDefault keep (K1 i (IntMap c)) where   gdef = K1 I.empty   {-# INLINE gdef #-} -instance GDefault f => GDefault (M1 i c f) where-  gdef = M1 gdef+instance GDefault keep f => GDefault keep (M1 i c f) where+  gdef = M1 $ gdef @keep   {-# INLINE gdef #-} -instance (GDefault a, GDefault b) => GDefault (a :*: b) where-  gdef = gdef :*: gdef+instance (GDefault keep a, GDefault keep b) => GDefault keep (a :*: b) where+  gdef = gdef @keep :*: gdef @keep   {-# INLINE gdef #-}