{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_HADDOCK hide #-}
module Data.Equality.Graph.Internal where
import Data.Equality.Graph.ReprUnionFind
import Data.Equality.Graph.Classes
import Data.Equality.Graph.Nodes
data EGraph analysis language = EGraph
{ forall analysis (language :: * -> *).
EGraph analysis language -> ReprUnionFind
unionFind :: !ReprUnionFind
, forall analysis (language :: * -> *).
EGraph analysis language -> ClassIdMap (EClass analysis language)
classes :: !(ClassIdMap (EClass analysis language))
, forall analysis (language :: * -> *).
EGraph analysis language -> Memo language
memo :: !(Memo language)
, forall analysis (language :: * -> *).
EGraph analysis language -> Worklist language
worklist :: !(Worklist language)
, forall analysis (language :: * -> *).
EGraph analysis language -> Worklist language
analysisWorklist :: !(Worklist language)
}
type Memo l = NodeMap l ClassId
type Worklist l = [(ClassId, ENode l)]
instance (Show a, Show (l ClassId)) => Show (EGraph a l) where
show :: EGraph a l -> String
show (EGraph ReprUnionFind
a ClassIdMap (EClass a l)
b Memo l
c Worklist l
d Worklist l
e) =
String
"UnionFind: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> ReprUnionFind -> String
forall a. Show a => a -> String
show ReprUnionFind
a String -> ShowS
forall a. Semigroup a => a -> a -> a
<>
String
"\n\nE-Classes: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> ClassIdMap (EClass a l) -> String
forall a. Show a => a -> String
show ClassIdMap (EClass a l)
b String -> ShowS
forall a. Semigroup a => a -> a -> a
<>
String
"\n\nHashcons: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Memo l -> String
forall a. Show a => a -> String
show Memo l
c String -> ShowS
forall a. Semigroup a => a -> a -> a
<>
String
"\n\nWorklist: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Worklist l -> String
forall a. Show a => a -> String
show Worklist l
d String -> ShowS
forall a. Semigroup a => a -> a -> a
<>
String
"\n\nAnalWorklist: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Worklist l -> String
forall a. Show a => a -> String
show Worklist l
e