Start to add basic gibbing
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
module Dodge.Base.NewID where
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
-- | place an new object into an intmap and update its id
|
||||
plNewUpID :: ALens' b (IM.IntMap a)
|
||||
-> ALens' a Int
|
||||
-> a
|
||||
-> b
|
||||
-> (Int,b)
|
||||
plNewUpID l li x w = (i,w & l #%~ IM.insert i (x & li #~ i))
|
||||
where
|
||||
i = IM.newKey $ w ^# l
|
||||
|
||||
-- | place an new object into an intmap and update its id
|
||||
plNew :: ALens' b (IM.IntMap a)
|
||||
-> ALens' a Int
|
||||
-> a
|
||||
-> b
|
||||
-> b
|
||||
plNew l li x = snd . plNewUpID l li x
|
||||
Reference in New Issue
Block a user