Wednesday, October 21, 2020

October 2020 Haskell 1-Liners

  • 2020-10-21: Curry `key` from
    secondPassFilter :: Ord a => a -> Set a -> Maybe b
    secondPassFilter key = spf key . Set.lookupGE key

    Given spf :: a -> Maybe a -> Maybe b
  • 2020-10-21: given: updater :: b -> Maybe b
    and firstPass :: Ord a => Map a b -> Map a b
    firstPass m = foldr (Map.update updater) m (Map.keys m)
    #Curry away `m` from the firstPass-function
    • Social Justice Cleric @noaheasterly
      firstPass = foldr (Map.update updater) <*> Map.keys
  • 2020-10-20: all (\c -> any (`isPrefixOf` c) setb) notinb
    #Curry away the `c` lambda argument.

No comments: