<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.Anneal
-- Copyright   :  (c) <NAME>
-- License     :  BSD-style (see LICENSE)
--
-- Maintainer  :  <NAME> <<EMAIL>>
-- Stability   :  unstable
-- Portability :  unportable
--
--
-----------------------------------------------------------------------------

module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating
                            , anneal, annealMax ) where

import System.Random ( StdGen, Random, mkStdGen, randomR )
import Control.Monad.State ( State, runState, put, get, gets, modify )

-- %import XMonadContrib.Anneal

data Rated a b = Rated !a !b
                 deriving ( Show )
instance Functor (Rated a) where
    f `fmap` (Rated v a) = Rated v (f a)

the_value :: Rated a b -> b
the_value (Rated _ b) = b
the_rating :: Rated a b -> a
the_rating (Rated a _) = a

instance Eq a => Eq (Rated a b) where
    (Rated a _) == (Rated a' _) = a == a'
instance Ord a => Ord (Rated a b) where
    compare (Rated a _) (Rated a' _) = compare a a'<commit_msg>'Anneal' requires 'random' package in ghc 6.8<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.Anneal
-- Copyright   :  (c) <NAME>
-- License     :  BSD-style (see LICENSE)
--
-- Maintainer  :  <NAME> <<EMAIL>>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Requires the 'random' package
--
-----------------------------------------------------------------------------

module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating
                            , anneal, annealMax ) where

import System.Random ( StdGen, Random, mkStdGen, randomR )
import Control.Monad.State ( State, runState, put, get, gets, modify )

-- %import XMonadContrib.Anneal

data Rated a b = Rated !a !b
                 deriving ( Show )
instance Functor (Rated a) where
    f `fmap` (Rated v a) = Rated v (f a)

the_value :: Rated a b -> b
the_value (Rated _ b) = b
the_rating :: Rated a b -> a
the_rating (Rated a _) = a

instance Eq a => Eq (Rated a b) where
    (Rated a _) == (Rated a' _) = a == a'
instance Ord a => Ord (Rated a b) where
    compare (Rated a _) (Rated a' _) = compare a a'
{'fraction_non_alphanumeric': 0.249670908293111, 'fraction_numerical': 0.0008775778850372971, 'mean_word_length': 1.6237054085155351, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '6824808', 'n_tokens_mistral': 739, 'n_tokens_neox': 722, 'n_words': 233}