getParameterizedSpec :: DevGraphNavigator a => String -> a
                     -> Maybe (a, LNode DGNodeLab)
getParameterizedSpec n dgnav =
    -- search first actual param
    case searchNode (isJust . dgnPredParameterized n) dgnav of
      Nothing -> Nothing
      Just (dgn', (sn, _)) ->
          -- get the spec for the param
          fmap f $ firstMaybe dglPredInstance $ incoming dgnav sn
              where f edg = let sn' = linkSource edg
                            in (dgn', (sn', getLabel dgnav sn'))

-- | Search for the given name in any node
getParameterizedSpec :: DevGraphNavigator a => String -> a
                     -> Maybe (a, LNode DGNodeLab)
getParameterizedSpec n dgnav =
    -- search first actual param
    case searchNode (isJust . dgnPredParameterized n) dgnav of
      Nothing -> Nothing
      Just (dgn', (sn, _)) ->
          -- get the spec for the param
          fmap f $ firstMaybe dglPredInstance $ incoming dgnav sn
              where f edg = let sn' = linkSource edg
                            in (dgn', (sn', getLabel dgnav sn'))

-- | Search for the given name in any node
getParameterizedSpec n dgnav =
    -- search first actual param
    case searchNode (isJust . dgnPredParameterized n) dgnav of
      Nothing -> Nothing
      Just (dgn', (sn, _)) ->
          -- get the spec for the param
          fmap f $ firstMaybe dglPredInstance $ incoming dgnav sn
              where f edg = let sn' = linkSource edg
                            in (dgn', (sn', getLabel dgnav sn'))

-- | Search for the given name in any node