Safe Haskell | None |
---|
- forestReplaceChildren :: Forest a -> Idx -> a -> Forest a
- getAtIdx :: SubTypes a => a -> Idx -> Maybe Int -> Maybe SubT
- replaceAtIdx :: (SubTypes a, Typeable b) => a -> Idx -> b -> Maybe a
- getIdxForest :: Forest a -> Idx -> Maybe (Tree a)
- breadthLevels :: Forest a -> [[a]]
- mkSubstForest :: SubTypes a => a -> b -> Forest b
- depth :: Forest a -> Int
- tooDeep :: Int -> Maybe Int -> Bool
Documentation
forestReplaceChildren :: Forest a -> Idx -> a -> Forest aSource
:: SubTypes a | |
=> a | Value |
-> Idx | Index of hole |
-> Maybe Int | Maximum depth we want to extract |
-> Maybe SubT |
Returns the value at index idx. Returns nothing if the index is out of bounds.
:: (SubTypes a, Typeable b) | |
=> a | Parent value |
-> Idx | Index of hole to replace |
-> b | Value to replace with |
-> Maybe a |
Replace a value at index idx generically in a Tree/Forest generically.
getIdxForest :: Forest a -> Idx -> Maybe (Tree a)Source
Get the tree at idx in a forest. Nothing if the index is out-of-bounds.
breadthLevels :: Forest a -> [[a]]Source
Return the list of values at each level in a Forest Not like levels in Data.Tree (but what I imagined it should have done!).
mkSubstForest :: SubTypes a => a -> b -> Forest bSource
Make a substitution Forest (all proper children). Initially we don't replace anything.