<commit_before>{-|

Some useful utility functions and combinators.

-}

module Raaz.Core.Util
       ( module Raaz.Core.Util.ByteString
       ) where

import Raaz.Core.Util.ByteString
<commit_msg>added a helper function to lift monadic operations to reader level.<commit_after>{-|

Some useful utility functions and combinators.

-}

module Raaz.Core.Util
       ( module Raaz.Core.Util.ByteString
       , liftToReaderT
       ) where

import Control.Monad.Reader
import Raaz.Core.Util.ByteString

liftToReaderT :: ((a -> m b) -> m c) -> (a -> ReaderT r m b) -> ReaderT r m c
liftToReaderT mLift rCont = ReaderT $ mLift . flipR rCont
  where flipR :: (a -> ReaderT r m b) -> r -> a -> m b
        flipR action r a = runReaderT (action a) r

{'fraction_non_alphanumeric': 0.10512129380053908, 'fraction_numerical': 0.0, 'mean_word_length': 2.829896907216495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '4973534', 'n_tokens_mistral': 255, 'n_tokens_neox': 245, 'n_words': 82}