Some more functions and instances
Dependencies
- [2]
ZTIPFONRUse Max and Min rather than our own newtype - [3]
2WWXQOBTHaddocks - [4]
AZEW6CPYuntested - [5]
2BUBV6QXType and functions for multiple pareto fronts - [6]
YZP3U4U4Rename - [7]
2ETAVQ2DTuple instances
Change contents
- replacement in src/Math/ParetoFront.hs at line 1
{-# LANGUAGE DerivingVia, StandaloneDeriving #-}{-# LANGUAGE DerivingVia, GeneralizedNewtypeDeriving, StandaloneDeriving #-} - replacement in src/Math/ParetoFront.hs at line 10
getFrontgetFront,quota,nestedFold - replacement in src/Math/ParetoFront.hs at line 18
import Data.Semigroup(Max(..), Min(..))import Data.Semigroup(Arg(..), Max(..), Min(..)) - replacement in src/Math/ParetoFront.hs at line 25
-- | Where the items are equal by all used criteria-- | Where no item is preferred by any used criterion - edit in src/Math/ParetoFront.hs at line 65
instance Debatable a => Debatable (Arg a b) whereweigh (Arg a _) (Arg b _) = weigh a b - replacement in src/Math/ParetoFront.hs at line 83
newtype Front a = Front [a] deriving (Show)newtype Front a = Front [a] deriving (Foldable, Show) - edit in src/Math/ParetoFront.hs at line 89
instance Foldable Strata wherefoldMap f (Strata l) = foldMap (foldMap f) l - edit in src/Math/ParetoFront.hs at line 142
-- | Drop fronts after those accounting for the first n items.quota :: Int -> Strata a -> Strata aquota _ (Strata []) = Strata []quota n (Strata (a:r))| n > 0 = letStrata r' = quota (n - length (getFront a)) (Strata r)in Strata (a : r')| otherwise = Strata []-- | 'foldMap' each front separately with one function, then 'foldMap' the-- results.nestedFold :: (Monoid m, Monoid n) => (a -> m) -> (m -> n) -> Strata a -> nnestedFold f g (Strata l) = foldMap (g . foldMap f) l