module Graphs.GraphDisp(
Graph(..),
newGraph,
redraw,
getMultipleNodes,
GraphParms(emptyGraphParms),
newNode,
setNodeType,
deleteNode,
setNodeFocus,
getNodeValue,
setNodeValue,
newNodeType,
NodeTypeParms(..),
newArc,
WrappedNode(..),
newArcListDrawer,
deleteArc,
setArcValue,
setArcType,
getArcValue,
newArcType,
ArcTypeParms(..),
Eq1(..),Ord1(..),
GraphAll(displaySort),
GraphClass(..),
NewGraph(..),
GraphConfig,
NewNode(..),
DeleteNode(..),
SetNodeFocus(..),
NodeClass,
NodeTypeClass,
NewNodeType(..),
NodeTypeConfig,
NewArc(..),
SetArcType(..),
DeleteArc(..),
ArcClass,
ArcTypeClass(..),
NewArcType(..),
ArcTypeConfig,
) where
import Data.Typeable
import Util.VariableList hiding (redraw)
import Util.Delayer(HasDelayer(..))
import Events.Events(Event)
import Events.Destructible
newtype
GraphAll graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms
=> Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms
= Graph graph deriving (Eq,Ord)
instance (GraphAll graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
=> Destroyable (Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) where
destroy (Graph graph) = destroy graph
instance (GraphAll graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
=> Destructible (Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) where
destroyed (Graph graph) = destroyed graph
instance (GraphAll graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
=> HasDelayer (Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) where
toDelayer (Graph graph) = toDelayer graph
newGraph :: (GraphAll graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms) ->
graphParms
-> IO (Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
newGraph
(_::(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms))
(graphParms :: graphParms) =
do
(graph :: graph) <- newGraphPrim graphParms
return (Graph graph ::
Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
redraw :: (GraphAll graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
-> IO ()
redraw (Graph graph) = redrawPrim graph
getMultipleNodes :: (GraphAll graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
-> (Event (WrappedNode node) -> IO a) -> IO a
getMultipleNodes (Graph graph) = getMultipleNodesPrim graph
class GraphParms graphParms where
emptyGraphParms :: graphParms
newNode :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType arcTypeParms)
-> nodeType value -> value -> IO (node value)
newNode
((Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms))
(nodeType :: nodeType value)
(value :: value) = (newNodePrim graph nodeType value) :: IO (node value)
setNodeType :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType arcTypeParms)
-> node value -> nodeType value -> IO ()
setNodeType
((Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms))
(node :: node value)
(nodeType :: nodeType value)
= (setNodeTypePrim graph node nodeType) :: IO ()
deleteNode :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> node value -> IO ()
deleteNode
((Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms))
(node :: node value) = deleteNodePrim graph node
setNodeFocus :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> node value -> IO ()
setNodeFocus
((Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms))
(node :: node value) = setNodeFocusPrim graph node
getNodeValue :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> node value -> IO value
getNodeValue
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
(node :: node value) = getNodeValuePrim graph node
setNodeValue :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> node value -> value -> IO ()
setNodeValue
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
(node :: node value) value = setNodeValuePrim graph node value
newNodeType :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms arc arcType
arcTypeParms)
-> nodeTypeParms value -> IO (nodeType value)
newNodeType
((Graph graph :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms))
(nodeTypeParms :: nodeTypeParms value) =
(newNodeTypePrim graph nodeTypeParms) :: IO (nodeType value)
class NodeTypeParms nodeTypeParms where
emptyNodeTypeParms :: Typeable value =>
nodeTypeParms value
coMapNodeTypeParms :: (Typeable value1,Typeable value2) =>
(value2 -> value1) -> nodeTypeParms value1 -> nodeTypeParms value2
newArc :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,
Typeable value,Typeable nodeFromValue,Typeable nodeToValue) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> arcType value -> value -> node nodeFromValue -> node nodeToValue
-> IO (arc value)
newArc
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
(arcType :: arcType value)
(value :: value)
(nodeFrom :: node nodeFromValue)
(nodeTo :: node nodeToValue) =
(newArcPrim graph arcType value nodeFrom nodeTo) :: IO (arc value)
newArcListDrawer :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,
Typeable value,Typeable nodeFromValue)
=> (Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
-> node nodeFromValue
-> ListDrawer (arcType value,value,WrappedNode node) (arc value)
newArcListDrawer
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms)
(nodeFrom :: node nodeFromValue) =
(newArcListDrawerPrim graph nodeFrom)
deleteArc :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,
Typeable value)=>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms) -> arc value -> IO ()
deleteArc
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms)
(arc :: arc value) = deleteArcPrim graph arc
setArcValue :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms) -> arc value -> value -> IO ()
setArcValue
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms)
(arc :: arc value) (value :: value) = setArcValuePrim graph arc value
setArcType :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms) -> arc value -> arcType value -> IO ()
setArcType
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms)
(arc :: arc value) (arcType :: arcType value)
= setArcTypePrim graph arc arcType
getArcValue :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms) -> arc value -> IO value
getArcValue
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms)
(arc :: arc value) = getArcValuePrim graph arc
newArcType :: (GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms,Typeable value) =>
(Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms) ->
arcTypeParms value -> IO (arcType value)
newArcType
(Graph graph :: Graph graph graphParms node nodeType nodeTypeParms arc
arcType arcTypeParms)
(arcTypeParms :: arcTypeParms value) =
(newArcTypePrim graph arcTypeParms) :: IO (arcType value)
class ArcTypeParms arcTypeParms where
emptyArcTypeParms :: Typeable value => arcTypeParms value
invisibleArcTypeParms :: Typeable value => arcTypeParms value
coMapArcTypeParms :: (Typeable value1,Typeable value2) =>
(value2 -> value1) -> arcTypeParms value1 -> arcTypeParms value2
class (GraphClass graph,NewGraph graph graphParms,GraphParms graphParms,
NewNode graph node nodeType,DeleteNode graph node,SetNodeFocus graph node,
NodeClass node,Typeable1 node,NodeTypeClass nodeType,
NewNodeType graph nodeType nodeTypeParms,NodeTypeParms nodeTypeParms,
NewArc graph node node arc arcType,
SetArcType graph arc arcType,
DeleteArc graph arc,
ArcClass arc,Typeable1 arc,ArcTypeClass arcType,
NewArcType graph arcType arcTypeParms
) =>
GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms where
displaySort :: Graph graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms
instance (GraphClass graph,NewGraph graph graphParms,GraphParms graphParms,
NewNode graph node nodeType,DeleteNode graph node,SetNodeFocus graph node,
NodeClass node,NodeTypeClass nodeType,
NewNodeType graph nodeType nodeTypeParms,NodeTypeParms nodeTypeParms,
NewArc graph node node arc arcType,
SetArcType graph arc arcType,
DeleteArc graph arc,
ArcClass arc,ArcTypeClass arcType,
NewArcType graph arcType arcTypeParms
) =>
GraphAll graph graphParms node nodeType nodeTypeParms
arc arcType arcTypeParms where
displaySort = displaySort
class (Destructible graph,Ord graph,Typeable graph,HasDelayer graph)
=> GraphClass graph where
redrawPrim :: graph -> IO ()
class (GraphClass graph,GraphParms graphParms)
=> NewGraph graph graphParms where
newGraphPrim :: graphParms -> IO graph
class GraphConfig graphConfig
class (GraphClass graph,NodeClass node,NodeTypeClass nodeType) =>
NewNode graph node nodeType where
newNodePrim :: Typeable value =>
graph -> nodeType value -> value -> IO (node value)
setNodeTypePrim :: Typeable value =>
graph -> node value -> nodeType value -> IO ()
class (GraphClass graph,NodeClass node) =>
DeleteNode graph node where
deleteNodePrim :: Typeable value =>
graph -> node value -> IO ()
getNodeValuePrim :: Typeable value =>
graph -> node value -> IO value
setNodeValuePrim :: Typeable value =>
graph -> node value -> value -> IO ()
getMultipleNodesPrim :: graph -> (Event (WrappedNode node) -> IO a) -> IO a
class (GraphClass graph,NodeClass node) =>
SetNodeFocus graph node where
setNodeFocusPrim :: Typeable value =>
graph -> node value -> IO ()
class (Typeable1 node,Ord1 node) => NodeClass node
class Typeable1 nodeType => NodeTypeClass nodeType
class (GraphClass graph,NodeTypeClass nodeType,NodeTypeParms nodeTypeParms)
=> NewNodeType graph nodeType nodeTypeParms where
newNodeTypePrim :: Typeable value =>
graph -> nodeTypeParms value -> IO (nodeType value)
class Kind1 nodeTypeConfig => NodeTypeConfig nodeTypeConfig
class (GraphClass graph,NodeClass nodeFrom,NodeClass nodeTo,ArcClass arc,
ArcTypeClass arcType)
=> NewArc graph nodeFrom nodeTo arc arcType where
newArcPrim ::
(Typeable value,Typeable nodeFromValue,Typeable nodeToValue)
=> graph -> arcType value -> value
-> nodeFrom nodeFromValue -> nodeTo nodeToValue
-> IO (arc value)
newArcListDrawerPrim ::
(Typeable value,Typeable nodeFromValue)
=> graph -> nodeFrom nodeFromValue
-> ListDrawer (arcType value,value,WrappedNode nodeTo) (arc value)
class (ArcClass arc,ArcTypeClass arcType) => SetArcType graph arc arcType where
setArcTypePrim ::
Typeable value => graph -> arc value -> arcType value -> IO ()
data WrappedNode node = forall value . Typeable value
=> WrappedNode (node value)
class (GraphClass graph,ArcClass arc) => DeleteArc graph arc where
deleteArcPrim :: (Typeable value) => graph -> arc value -> IO ()
setArcValuePrim :: Typeable value => graph -> arc value -> value -> IO ()
getArcValuePrim :: Typeable value => graph -> arc value -> IO value
class (Typeable1 arc,Ord1 arc) => ArcClass arc
class (Typeable1 arcType,Ord1 arcType) => ArcTypeClass arcType where
invisibleArcType :: Typeable value => arcType value
class (GraphClass graph,ArcTypeClass arcType,ArcTypeParms arcTypeParms) =>
NewArcType graph arcType arcTypeParms where
newArcTypePrim :: Typeable value =>
graph -> arcTypeParms value -> IO (arcType value)
class Kind1 arcTypeConfig => ArcTypeConfig arcTypeConfig
class Kind1 takesParm where
kindOne :: takesParm value -> ()
instance Kind1 takesParm where
kindOne _ = ()
class Kind2 takes2Parms where
kindTwo :: takes2Parms value1 value2-> ()
instance Kind2 takesParms where
kindTwo _ = ()
class Kind3 takes3Parms where
kindThree :: takes3Parms value1 value2 value3 -> ()
instance Kind3 takesParms where
kindThree _ = ()
class Eq1 takesParm where
eq1 :: takesParm value1 -> takesParm value1 -> Bool
class Eq1 takesParm => Ord1 takesParm where
compare1 :: takesParm value1 -> takesParm value1 -> Ordering