<commit_before>{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Haskeroids.Random
    ( randomBracket
    , randomBetween
    , randomPair
    , randomAngle
    , randomElliptical
    , nrandomR
    , initRandomGen
    , runRandom
    , Random
    , RandomGen
    ) where

import qualified System.Random as R
import Control.Monad (liftM2, replicateM)
import Control.Monad.State

type RandomGen = R.StdGen
newtype Random a = Random { runR :: State RandomGen a} deriving Monad<commit_msg>manually implemented instance instead of GeneralizedNewtypeDeriving<commit_after>
module Haskeroids.Random
    ( randomBracket
    , randomBetween
    , randomPair
    , randomAngle
    , randomElliptical
    , nrandomR
    , initRandomGen
    , runRandom
    , Random
    , RandomGen
    ) where

import qualified System.Random as R
import Control.Monad (liftM2, replicateM, Monad)
import Control.Monad.State

type RandomGen = R.StdGen
newtype Random a = Random { runR :: State RandomGen a}

instance Monad Random where
    return a = Random (return a)
    (Random a) >>= b = Random $ a >>= (runR . b)
{'fraction_non_alphanumeric': 0.07431192660550459, 'fraction_numerical': 0.001834862385321101, 'mean_word_length': 3.364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '767681', 'n_tokens_mistral': 342, 'n_tokens_neox': 332, 'n_words': 97}