diff options
Diffstat (limited to 'Anneal.hs')
-rw-r--r-- | Anneal.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Anneal.hs b/Anneal.hs new file mode 100644 index 0000000..5083030 --- /dev/null +++ b/Anneal.hs @@ -0,0 +1,19 @@ +module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating, anneal ) where + +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' + +anneal :: a -> (a -> Double) -> (a -> [a]) -> Rated Double a +anneal = undefined |