-- | create a sub menu for taxonomy visualisation
createMenuTaxonomy :: GInfo -> ButtonMenu GA.NodeValue
createMenuTaxonomy gi = let
  passTh displayFun descr _ = do
    ost <- readIORef $ intState gi
    case i_state ost of
      Nothing -> return ()
      Just ist -> case computeTheory (i_libEnv ist) (libName gi) descr of
        Just th -> displayFun (show descr) th
        Nothing -> errorDialog "Error"
          $ "no global theory for node " ++ show descr
  in Menu (Just "Taxonomy graphs")
    [ createMenuButton "Subsort graph" (passTh displaySubsortGraph) gi
    , createMenuButton "Concept graph" (passTh displayConceptGraph) gi ]
createMenuTaxonomy :: GInfo -> ButtonMenu GA.NodeValue
createMenuTaxonomy gi = let
  passTh displayFun descr _ = do
    ost <- readIORef $ intState gi
    case i_state ost of
      Nothing -> return ()
      Just ist -> case computeTheory (i_libEnv ist) (libName gi) descr of
        Just th -> displayFun (show descr) th
        Nothing -> errorDialog "Error"
          $ "no global theory for node " ++ show descr
  in Menu (Just "Taxonomy graphs")
    [ createMenuButton "Subsort graph" (passTh displaySubsortGraph) gi
    , createMenuButton "Concept graph" (passTh displayConceptGraph) gi ]
createMenuTaxonomy gi = let
  passTh displayFun descr _ = do
    ost <- readIORef $ intState gi
    case i_state ost of
      Nothing -> return ()
      Just ist -> case computeTheory (i_libEnv ist) (libName gi) descr of
        Just th -> displayFun (show descr) th
        Nothing -> errorDialog "Error"
          $ "no global theory for node " ++ show descr
  in Menu (Just "Taxonomy graphs")
    [ createMenuButton "Subsort graph" (passTh displaySubsortGraph) gi
    , createMenuButton "Concept graph" (passTh displayConceptGraph) gi ]