<commit_before>{-# Language TemplateHaskell #-}

module Peeker ( Peek
              , (~>)
              , getP
              , updP
              , getS
              , updS
              , liftP
              , listP
              , derivePeek
              ) where

import Control.Monad.State

import Language.Haskell.TH hiding (listP)

type Peek a b = a -> (b, b -> a)

(~>) :: Peek a b -> Peek b c -> Peek a c
(~>) p1 p2 x = (getP p2 y, updP p1 x . updP p2 y)
               where y = getP p1 x<commit_msg>Warning about naming clash with Control.Monad.State.<commit_after>{-# Language TemplateHaskell #-}

module Peeker ( Peek
              , (~>)
              , getP
              , updP
              , getS
              , updS
              , liftP
              , listP
              , derivePeek
              ) where

{-
TODO: getS clashes with gets from Control.Monad.State. They mean similar
things, and get is different from getP, which makes things complicated.
-}
import Control.Monad.State

import Language.Haskell.TH hiding (listP)

type Peek a b = a -> (b, b -> a)

(~>) :: Peek a b -> Peek b c -> Peek a c
(~>) p1 p2 x = (getP p2 y, updP p1 x . updP p2 y)
               where y = getP p1 x
{'fraction_non_alphanumeric': 0.10561056105610561, 'fraction_numerical': 0.009900990099009901, 'mean_word_length': 1.4067460317460319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6108650', 'n_tokens_mistral': 410, 'n_tokens_neox': 391, 'n_words': 133}