Report a paste

Please put a quick comment for the admin.

If it looks like spam, the admin will mark it as spam so that the spam filter picks it up in the future.

If the paste contains something private or offensive, it'll probably just be deleted.

No title

-- imagine I have this record, for which I create lens
data FileInfo = FileInfo
    _modifyTime :: String
    , _changeTime :: String
  } deriving (Show,Read,Generic)

-- I have a function which does the same things, only depending on the getter that is used
import qualified FileInfo as FI
isUserMoreRecent :: a -> Maybe Time -> FI.FileInfo -> FI.FileInfo -> Bool
isUserMoreRecent getter lastSynchroTime ufi mfi = isRecent || isMoreRecentThanLastSynchro
    isRecent = (view getter ufi) < (view getter mfi)
    isMoreRecentThanLastSynchro = (view getter ufi) < lastSynchroTime

-- I try to use it this way in the code of a local function
        predModif :: FileInfo -> Bool
        predModif  = isUserMoreRecent FI.modifyTime lastSynchroTime ufi
        predChange :: FileInfo -> Bool
        predChange = isUserMoreRecent FI.changeTime lastSynchroTime ufi

-- unfortunately it doesnt compile
-- I was going to switch to the record field name to pass as argument, but I'd prefer trying to understand why using the lens getters did not work
/src/MasterAsk.hs:123:40: error:
     Ambiguous type variable f1 arising from a use of FI.modifyTime
      prevents the constraint (Functor f1) from being solved.
      Probable fix: use a type annotation to specify what f1 should be.
      These potential instances exist:
        instance Functor (Either a) -- Defined in ‘Data.Either’
        instance Functor Identity -- Defined in ‘Data.Functor.Identity’
        instance Functor IO -- Defined in ‘GHC.Base’ 9 others 119 instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)
     In the first argument of isUserMoreRecent, namely
      In the expression:
        (isUserMoreRecent FI.modifyTime lastSynchroTime ufi)
      In an equation for predModif:
          predModif = (isUserMoreRecent FI.modifyTime lastSynchroTime ufi)