From 5d8c5d807c166cb428f87f8e1a740b8ed4b661f0 Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 14 Mar 2017 22:18:39 +0100 Subject: [PATCH] a little lint --- src/Affection/Particle.hs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Affection/Particle.hs b/src/Affection/Particle.hs index 863e616..4d9649d 100644 --- a/src/Affection/Particle.hs +++ b/src/Affection/Particle.hs @@ -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