show everything

This commit is contained in:
nek0 2017-07-29 02:20:32 +02:00
parent f544b5f025
commit 2499fe526a
2 changed files with 8 additions and 8 deletions

View file

@ -18,19 +18,19 @@ import qualified Control.Monad.Parallel as MP
import Affection.Types import Affection.Types
data Ord a => Actor a = Actor data (Show a, Ord a) => Actor a = Actor
{ actorProperties :: [ActorProperty a] { actorProperties :: [ActorProperty a]
, actorNodes :: M.Map a G.GeglNode , actorNodes :: M.Map a G.GeglNode
, actorFlange :: G.GeglNode , actorFlange :: G.GeglNode
} deriving (Eq) } deriving (Show, Eq)
data Ord a => ActorProperty a = ActorProperty data (Show a, Ord a) => ActorProperty a = ActorProperty
{ apName :: String { apName :: String
, apValue :: G.PropertyValue , apValue :: G.PropertyValue
, apMapping :: Maybe (a, String) , apMapping :: Maybe (a, String)
} deriving (Eq) } deriving (Show, Eq)
updateProperties :: Ord a => [G.Property] -> Actor a -> Actor a updateProperties :: (Show a, Ord a) => [G.Property] -> Actor a -> Actor a
updateProperties ps act@Actor{..} = updateProperties ps act@Actor{..} =
act act
{ actorProperties = { actorProperties =
@ -46,7 +46,7 @@ updateProperties ps act@Actor{..} =
| apName p == n = p | apName p == n = p
| otherwise = getProp' n ps | otherwise = getProp' n ps
applyProperties :: Ord a => Actor a -> Affection us () applyProperties :: (Show a, Ord a) => Actor a -> Affection us ()
applyProperties Actor{..} = applyProperties Actor{..} =
MP.mapM_ (\(ActorProperty{..}) -> MP.mapM_ (\(ActorProperty{..}) ->
maybe (return ()) (\m -> maybe (return ()) (\m ->
@ -55,7 +55,7 @@ applyProperties Actor{..} =
) apMapping ) apMapping
) actorProperties ) actorProperties
getProperty :: Ord a => String -> Actor a -> Maybe G.PropertyValue getProperty :: (Show a, Ord a) => String -> Actor a -> Maybe G.PropertyValue
getProperty name act = getProperty name act =
case find (\a -> name == apName a) $ actorProperties act of case find (\a -> name == apName a) $ actorProperties act of
Just p -> Just $ apValue p Just p -> Just $ apValue p

View file

@ -23,7 +23,7 @@ data SpriteAnimation = SpriteAnimation
} }
runAnimation runAnimation
:: Ord a :: (Show a, Ord a)
=> Actor a => Actor a
-> SpriteAnimation -> SpriteAnimation
-> Affection us (SpriteAnimation, Actor a) -> Affection us (SpriteAnimation, Actor a)