build :: Monad m => InstanceBuilder a b m r -> m (TypedDigraph a b, [Rule a b])
build i = do
    (g, t, rs, _) <- liftM snd $ runStateT i (empty, empty, [], -1)
    return (TypedDigraph g t, map snd rs)

-- | Creates a new rule, returns the id
build :: Monad m => InstanceBuilder a b m r -> m (TypedDigraph a b, [Rule a b])
build i = do
    (g, t, rs, _) <- liftM snd $ runStateT i (empty, empty, [], -1)
    return (TypedDigraph g t, map snd rs)

-- | Creates a new rule, returns the id
build i = do
    (g, t, rs, _) <- liftM snd $ runStateT i (empty, empty, [], -1)
    return (TypedDigraph g t, map snd rs)

-- | Creates a new rule, returns the id