<commit_before>module Photon.Utils.Directory (
    -- * Sorting files
    partitionFileDir
  ) where

import Photon.Control.Monad ( partitionM )
import System.Directory ( doesDirectoryExist, doesFileExist )

partitionFileDir :: [FilePath] -> IO ([FilePath],[FilePath])
partitionFileDir files = do
    (f,r) <- partitionM doesFileExist files
    d <- fmap fst $ partitionM doesDirectoryExist r
    return (f,d)<commit_msg>Documentation.<commit_after>-----------------------------------------------------------------------------
-- |
-- Copyright   : (C) 2014 <NAME>
-- License     : BSD3
--
-- Maintainer  : <NAME> <<EMAIL>>
-- Stability   : experimental
-- Portability : portable
--
-- This module adds a few stuff to "System.Directory".
----------------------------------------------------------------------------

module Photon.Utils.Directory (
    -- * Sorting files
    partitionFileDir
  ) where

import Photon.Control.Monad ( partitionM )
import System.Directory ( doesDirectoryExist, doesFileExist )

-- |Partition files into a list of *files* and a list of *directories*.
-- If a file is not a directory, it’s considered as a file.
partitionFileDir :: [FilePath] -> IO ([FilePath],[FilePath])
partitionFileDir files = do
    (f,r) <- partitionM doesFileExist files
    d <- fmap fst $ partitionM doesDirectoryExist r
    return (f,d)
{'fraction_non_alphanumeric': 0.21684053651266766, 'fraction_numerical': 0.0037257824143070045, 'mean_word_length': 2.25181598062954, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2817696', 'n_tokens_mistral': 372, 'n_tokens_neox': 357, 'n_words': 109}