module Data.Patricia.Word.Debug
  ( Validity (..)
  , Reason (..)
  ) where

import           Radix.Word.Foundation



-- | Whether the tree is well-formed.
data Validity = Valid
              | Invalid Reason
                deriving Int -> Validity -> ShowS
[Validity] -> ShowS
Validity -> String
(Int -> Validity -> ShowS)
-> (Validity -> String) -> ([Validity] -> ShowS) -> Show Validity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Validity -> ShowS
showsPrec :: Int -> Validity -> ShowS
$cshow :: Validity -> String
show :: Validity -> String
$cshowList :: [Validity] -> ShowS
showList :: [Validity] -> ShowS
Show

-- | Reason for why the tree is considered malformed.
data Reason = -- | Prefix is @0@.
              ZeroPrefix
            | -- | Prefix below diverges from the prefix above.
              PrefixBelow Prefix Prefix
              -- | Key diverges the prefix above.
            | KeyBelow Prefix Key
              -- | One of the branches is empty.
            | MalformedBin Prefix
              deriving Int -> Reason -> ShowS
[Reason] -> ShowS
Reason -> String
(Int -> Reason -> ShowS)
-> (Reason -> String) -> ([Reason] -> ShowS) -> Show Reason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Reason -> ShowS
showsPrec :: Int -> Reason -> ShowS
$cshow :: Reason -> String
show :: Reason -> String
$cshowList :: [Reason] -> ShowS
showList :: [Reason] -> ShowS
Show