{"body":"type Partial a = HKD a Last\n\ndata User = User\n  { name :: Text,\n    age :: Int,\n    adult :: Bool\n  }\n  deriving (Generic)\n\ntest :: [(String, Bool)]\ntest =\n  labelsWhere' (isJust . getLast) $\n    (mempty :: Partial User)\n      & field @\"name\" .~ pure \"name here\"\n\nlabelsWhere' ::\n  forall structure f.\n  ( Label structure,\n    ApplicativeB (HKD structure),\n    TraversableB (HKD structure),\n    AllB Show (HKD structure)\n  ) =>\n  (forall a. f a -> Bool) ->\n  HKD structure f ->\n  [(String, Bool)]\nlabelsWhere' p =\n  getConst . btraverse go . bprod label\n  where\n    go :: Product (Const String) f a -> (Const [(String, Bool)]) (Maybe a)\n    go (Pair (Const key) value) = Const [(key, p value) | p value]\n","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/PGucY4I0","modified":1612470340,"id":"PGucY4I0","size":704,"lines":30,"own_paste":false,"theme":"","date":1612470340}