X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FFunction.hs;h=bc851a045dd524856f208e781eecf6a66eaca99f;hb=a0d7892da0d00fee781a550ef353df8734be5884;hp=b6ccd13e6605df4a8ff768e8aff024ae36d93657;hpb=4c73deaea29ea99540ea7763cd16e808361a85b1;p=haskell-directory.git diff --git a/Data/Function.hs b/Data/Function.hs index b6ccd13..bc851a0 100644 --- a/Data/Function.hs +++ b/Data/Function.hs @@ -14,11 +14,19 @@ module Data.Function ( -- * "Prelude" re-exports id, const, (.), flip, ($) -- * Other combinators + , fix , on ) where +import Prelude + infixl 0 `on` +-- | @'fix' f@ is the least fixed point of the function @f@, +-- i.e. the least defined @x@ such that @f x = x@. +fix :: (a -> a) -> a +fix f = let x = f x in x + -- | @(*) \`on\` f = \\x y -> f x * f y@. -- -- Typical usage: @'Data.List.sortBy' ('compare' \`on\` 'fst')@.