Remove Annotation datatype
This commit is contained in:
@@ -5,6 +5,8 @@ module Dodge.Data.MetaTree where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Tree
|
||||
import System.Random
|
||||
import Control.Monad.State
|
||||
|
||||
data MetaTree a b = MTree
|
||||
{_mtLabel :: b, _mtTree :: MetaNode a b, _mtBranches :: [MetaBranch a b]}
|
||||
@@ -23,3 +25,23 @@ makeLenses ''MetaNode
|
||||
|
||||
instance Functor (MetaTree a) where
|
||||
fmap f (MTree b mn bs) = MTree (f b) (mn & nodeMetaTree %~ fmap f) (map (mbTree %~ fmap f) bs)
|
||||
|
||||
data LayoutVars = LayVars
|
||||
{ _lyGen :: StdGen
|
||||
, _lyCounter :: Int
|
||||
}
|
||||
|
||||
makeLenses ''LayoutVars
|
||||
|
||||
instance RandomGen LayoutVars where
|
||||
genWord32 x = let (y,g) = genWord32 (x ^. lyGen)
|
||||
in (y,x & lyGen .~ g)
|
||||
genWord64 x = let (y,g) = genWord64 (x ^. lyGen)
|
||||
in (y,x & lyGen .~ g)
|
||||
split x = let (g,h) = split (x ^. lyGen) in (x & lyGen .~ g, x & lyGen .~ h)
|
||||
|
||||
nextLayoutInt :: State LayoutVars Int
|
||||
nextLayoutInt = do
|
||||
LayVars g i <- get
|
||||
put $ LayVars g (i + 1)
|
||||
return i
|
||||
|
||||
Reference in New Issue
Block a user