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