<commit_before>module Exercises where
  
import Control.Monad.Trans.State hiding (get, put, modify)

-- reminder, State isn't defined like this but it will
-- do as an approximation... 
-- ... a major difference is that the State constructor
-- is not exposed.
--
-- newtype State s a = State { runState :: s -> (a,s) }

-- 1.
get :: State s s
get = state $ \s -> (s, s)

-- note use the `state` function not the `State` constructor
-- state :: Monad m => (s -> (a,s)) -> StateT s m a<commit_msg>added comment link<commit_after>module Exercises where
  
import Control.Monad.Trans.State hiding (get, put, modify)

-- reminder, State isn't defined like this but it will
-- do as an approximation... 
-- ... a major difference is that the State constructor
-- is not exposed.
-- see https://mail.haskell.org/pipermail/beginners/2011-October/008882.html
--
-- newtype State s a = State { runState :: s -> (a,s) }

-- 1.
get :: State s s
get = state $ \s -> (s, s)

-- note use the `state` function not the `State` constructor
-- state :: Monad m => (s -> (a,s)) -> StateT s m a
{'fraction_non_alphanumeric': 0.15176908752327747, 'fraction_numerical': 0.0111731843575419, 'mean_word_length': 2.8120567375886525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 1, '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': '6647751', 'n_tokens_mistral': 357, 'n_tokens_neox': 343, 'n_words': 141}