{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.Equality.Graph.Classes
( module Data.Equality.Graph.Classes
, module Data.Equality.Graph.Classes.Id
) where
import qualified Data.Set as S
import Data.Functor.Classes
import Data.Equality.Graph.Classes.Id
import Data.Equality.Graph.Nodes
import Data.Equality.Analysis
data EClass l = EClass
{ forall (l :: * -> *). EClass l -> ClassId
eClassId :: {-# UNPACK #-} !ClassId
, forall (l :: * -> *). EClass l -> Set (ENode l)
eClassNodes :: !(S.Set (ENode l))
, forall (l :: * -> *). EClass l -> Domain l
eClassData :: Domain l
, forall (l :: * -> *). EClass l -> NodeMap l ClassId
eClassParents :: !(NodeMap l ClassId)
}
instance (Show (Domain l), Show1 l) => Show (EClass l) where
show :: EClass l -> String
show (EClass ClassId
a Set (ENode l)
b Domain l
d NodeMap l ClassId
c) = String
"Id: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> ClassId -> String
forall a. Show a => a -> String
show ClassId
a String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"\nNodes: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Set (ENode l) -> String
forall a. Show a => a -> String
show Set (ENode l)
b String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"\nParents: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> NodeMap l ClassId -> String
forall a. Show a => a -> String
show NodeMap l ClassId
c String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"\nData: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Domain l -> String
forall a. Show a => a -> String
show Domain l
d