a little lint

This commit is contained in:
nek0 2017-03-14 22:18:39 +01:00
parent 161ace0770
commit 5d8c5d807c

View file

@ -1,4 +1,3 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BangPatterns #-}
-- | This module introduces a simple particle system to Affection
@ -42,7 +41,7 @@ updateParticle time func l =
then
return []
else
return . (: []) =<< (func time p)
(: []) <$> func time p
updateParticle' dt fun (p:ps) = do
now <- elapsedTime <$> get
if particleCreation p + particleTimeToLive p < now
@ -51,7 +50,7 @@ updateParticle time func l =
updateParticle' dt fun ps
else do
np <- fun dt p
return . (np :) =<< updateParticle' dt fun ps
(np :) <$> updateParticle' dt fun ps
dropParticle p = do
mproducer <- liftIO $ G.gegl_node_get_producer
(particleStackCont p)
@ -60,11 +59,9 @@ updateParticle time func l =
consumers <- liftIO $ G.gegl_node_get_consumers
(particleStackCont p)
"output"
liftIO $ mapM_ (\(node, inpad) -> G.gegl_node_connect_to
liftIO $ mapM_ (uncurry $ G.gegl_node_connect_to
producer
padname
node
inpad
) consumers
) mproducer
@ -75,7 +72,7 @@ nextLiving
nextLiving [] = Nothing
nextLiving acc = case catMaybes acc of
[] -> Nothing
ps -> Just $ head $ ps
ps -> Just $ head ps
drawParticles
:: (Particle -> Affection us ())
@ -91,7 +88,7 @@ updateParticleSystem
-> Affection us ParticleSystem
updateParticleSystem sys sec upd draw = do
!x <- updateParticle sec upd (partStorList $ partSysParts sys)
if (not $ null x)
if not $ null x
then do
liftIO $ G.gegl_node_link (particleStackCont $ head x) (partSysNode sys)
mapM_ (draw (partSysBuffer sys) (partSysNode sys)) x
@ -118,7 +115,7 @@ insertParticle ps p = do
now <- elapsedTime <$> get
let newList = chronoInsert now (partStorList $ partSysParts ps) p
liftIO $ G.gegl_node_link_many (reverse $ map particleStackCont newList)
return $ ps
return ps
{ partSysParts = (partSysParts ps)
{ partStorLatest = Just p
, partStorList = newList