toOutputTree :: (RandomGen g) => Tree -> Rand g OutputTree
toOutputTree (Tree {..}) = do
    random_name <- randomName
    children' <- mapM toOutputTree _children
    return $ OutputTree {
               name = random_name,
               primary_wordO = _primary_word,
               search_wordO = _search_word,
               fnameO = toText' _fname,
               rails_directory = fnameToRailsDirectory _fname,
               lnumO = _lnum,
               is_actionO = _is_action,
               is_filter_defO = _is_filter_def,
               cornersO = corner_str,
               around_textO = _around_text,
               childrenO = children'
             }
      where
        corner_str = showCorners _corners

-- |
-- >>> parseGrepResult (pack "foo/bar.hs:123: foo bar")
-- Just (FilePath "foo/bar.hs",123," foo bar")
--
-- >>> parseGrepResult (pack "Binary file public/images/foo.jpg matches")
-- Nothing
toOutputTree :: (RandomGen g) => Tree -> Rand g OutputTree
toOutputTree (Tree {..}) = do
    random_name <- randomName
    children' <- mapM toOutputTree _children
    return $ OutputTree {
               name = random_name,
               primary_wordO = _primary_word,
               search_wordO = _search_word,
               fnameO = toText' _fname,
               rails_directory = fnameToRailsDirectory _fname,
               lnumO = _lnum,
               is_actionO = _is_action,
               is_filter_defO = _is_filter_def,
               cornersO = corner_str,
               around_textO = _around_text,
               childrenO = children'
             }
      where
        corner_str = showCorners _corners

-- |
-- >>> parseGrepResult (pack "foo/bar.hs:123: foo bar")
-- Just (FilePath "foo/bar.hs",123," foo bar")
--
-- >>> parseGrepResult (pack "Binary file public/images/foo.jpg matches")
-- Nothing
toOutputTree (Tree {..}) = do
    random_name <- randomName
    children' <- mapM toOutputTree _children
    return $ OutputTree {
               name = random_name,
               primary_wordO = _primary_word,
               search_wordO = _search_word,
               fnameO = toText' _fname,
               rails_directory = fnameToRailsDirectory _fname,
               lnumO = _lnum,
               is_actionO = _is_action,
               is_filter_defO = _is_filter_def,
               cornersO = corner_str,
               around_textO = _around_text,
               childrenO = children'
             }
      where
        corner_str = showCorners _corners

-- |
-- >>> parseGrepResult (pack "foo/bar.hs:123: foo bar")
-- Just (FilePath "foo/bar.hs",123," foo bar")
--
-- >>> parseGrepResult (pack "Binary file public/images/foo.jpg matches")
-- Nothing