symantic-grammar-0.2.0.20170709: Library for symantic grammars.

Safe HaskellNone
LanguageHaskell2010

Language.Symantic.Grammar.BinTree

Contents

Description

Binary tree, useful to build Abstract Syntax Tree (AST) made of applications of tokens.

Synopsis

Type BinTree

data BinTree a Source #

Binary Tree.

Constructors

BinTree0 a 
BinTree2 (BinTree a) (BinTree a) 

Instances

Monad BinTree Source # 

Methods

(>>=) :: BinTree a -> (a -> BinTree b) -> BinTree b #

(>>) :: BinTree a -> BinTree b -> BinTree b #

return :: a -> BinTree a #

fail :: String -> BinTree a #

Functor BinTree Source # 

Methods

fmap :: (a -> b) -> BinTree a -> BinTree b #

(<$) :: a -> BinTree b -> BinTree a #

Applicative BinTree Source # 

Methods

pure :: a -> BinTree a #

(<*>) :: BinTree (a -> b) -> BinTree a -> BinTree b #

(*>) :: BinTree a -> BinTree b -> BinTree b #

(<*) :: BinTree a -> BinTree b -> BinTree a #

Foldable BinTree Source # 

Methods

fold :: Monoid m => BinTree m -> m #

foldMap :: Monoid m => (a -> m) -> BinTree a -> m #

foldr :: (a -> b -> b) -> b -> BinTree a -> b #

foldr' :: (a -> b -> b) -> b -> BinTree a -> b #

foldl :: (b -> a -> b) -> b -> BinTree a -> b #

foldl' :: (b -> a -> b) -> b -> BinTree a -> b #

foldr1 :: (a -> a -> a) -> BinTree a -> a #

foldl1 :: (a -> a -> a) -> BinTree a -> a #

toList :: BinTree a -> [a] #

null :: BinTree a -> Bool #

length :: BinTree a -> Int #

elem :: Eq a => a -> BinTree a -> Bool #

maximum :: Ord a => BinTree a -> a #

minimum :: Ord a => BinTree a -> a #

sum :: Num a => BinTree a -> a #

product :: Num a => BinTree a -> a #

Traversable BinTree Source # 

Methods

traverse :: Applicative f => (a -> f b) -> BinTree a -> f (BinTree b) #

sequenceA :: Applicative f => BinTree (f a) -> f (BinTree a) #

mapM :: Monad m => (a -> m b) -> BinTree a -> m (BinTree b) #

sequence :: Monad m => BinTree (m a) -> m (BinTree a) #

Eq a => Eq (BinTree a) Source # 

Methods

(==) :: BinTree a -> BinTree a -> Bool #

(/=) :: BinTree a -> BinTree a -> Bool #

Show a => Show (BinTree a) Source # 

Methods

showsPrec :: Int -> BinTree a -> ShowS #

show :: BinTree a -> String #

showList :: [BinTree a] -> ShowS #

Semigroup (BinTree a) Source # 

Methods

(<>) :: BinTree a -> BinTree a -> BinTree a #

sconcat :: NonEmpty (BinTree a) -> BinTree a #

stimes :: Integral b => b -> BinTree a -> BinTree a #

collapseBT :: (a -> a -> a) -> BinTree a -> a Source #

Collapse depth-first given BinTree with given function.

Useful to apply all arguments.