-- | by increasing size, starting with 0

-- | for each state, a lazy list of terms
-- that are accepted in that state.
generate :: M.Map Int  [Maybe (Int,Int)]
         -> M.Map Int [[T]]
generate au = m 
    where m =  M.fromList $ do
            r <- M.keys au
            let series = unions $ do
                    v <- au M.! r
                    return $ case v of
                        Nothing -> [ [s]]
                        Just (p,q) -> 
                           [] : crosses app (m M.! p) (m M.! q)
            return (r, series)
generate :: M.Map Int  [Maybe (Int,Int)]
         -> M.Map Int [[T]]
generate au = m 
    where m =  M.fromList $ do
            r <- M.keys au
            let series = unions $ do
                    v <- au M.! r
                    return $ case v of
                        Nothing -> [ [s]]
                        Just (p,q) -> 
                           [] : crosses app (m M.! p) (m M.! q)
            return (r, series)
generate au = m 
    where m =  M.fromList $ do
            r <- M.keys au
            let series = unions $ do
                    v <- au M.! r
                    return $ case v of
                        Nothing -> [ [s]]
                        Just (p,q) -> 
                           [] : crosses app (m M.! p) (m M.! q)
            return (r, series)