{-# LANGUAGE DeriveFunctor #-}
-- | A simple binary tree type, 'BinaryTree'.
module Data.BinaryTree 
  ( BinaryTree(..)
  ) where

-- | A binary tree
--
-- Since there are multiple ways to traverse a 'BinaryTree', see 
-- "Data.Traversable.TreeLike" for newtype-wrappers with 'Traversable' instances.
data BinaryTree a = Leaf | Branch (BinaryTree a) a (BinaryTree a)
  deriving (Int -> BinaryTree a -> ShowS
forall a. Show a => Int -> BinaryTree a -> ShowS
forall a. Show a => [BinaryTree a] -> ShowS
forall a. Show a => BinaryTree a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinaryTree a] -> ShowS
$cshowList :: forall a. Show a => [BinaryTree a] -> ShowS
show :: BinaryTree a -> String
$cshow :: forall a. Show a => BinaryTree a -> String
showsPrec :: Int -> BinaryTree a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> BinaryTree a -> ShowS
Show, forall a b. a -> BinaryTree b -> BinaryTree a
forall a b. (a -> b) -> BinaryTree a -> BinaryTree b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> BinaryTree b -> BinaryTree a
$c<$ :: forall a b. a -> BinaryTree b -> BinaryTree a
fmap :: forall a b. (a -> b) -> BinaryTree a -> BinaryTree b
$cfmap :: forall a b. (a -> b) -> BinaryTree a -> BinaryTree b
Functor, BinaryTree a -> BinaryTree a -> Bool
forall a. Eq a => BinaryTree a -> BinaryTree a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BinaryTree a -> BinaryTree a -> Bool
$c/= :: forall a. Eq a => BinaryTree a -> BinaryTree a -> Bool
== :: BinaryTree a -> BinaryTree a -> Bool
$c== :: forall a. Eq a => BinaryTree a -> BinaryTree a -> Bool
Eq)