ソースを参照

Export ignoreNotFound function, making it some kind of combinator

jherve 1 年間 前
コミット
e4b743dc19
1 ファイル変更5 行追加3 行削除
  1. 5 3
      src/LinkedIn/ArtDecoCardAlt.purs

+ 5 - 3
src/LinkedIn/ArtDecoCardAlt.purs

@@ -84,14 +84,16 @@ queryArtDecoCardAlt n = runExceptT do
   pvs <- runOne ":scope div.pvs-entity--padded" n
 
   bold <- runOne ":scope div.t-bold > span[aria-hidden=true]" pvs
-  normal <- 
-    mapExceptT (map ignoreNotFound) $
+  normal <-
+    ignoreNotFound $
     runOne ":scope span.t-normal:not(t-black--light) > span[aria-hidden=true]" n
 
   pure $ ArtDecoCardAltElement { pvs_entity: ArtDecoCenterHeaderAlt {bold, normal: normal} }
 
+ignoreNotFound ∷ ∀ a f. Functor f ⇒ ExceptT QueryError f a → ExceptT QueryError f (Maybe a)
+ignoreNotFound = mapExceptT (map ignoreNotFound')
   where
-    ignoreNotFound = case _ of 
+    ignoreNotFound' = case _ of
       (Left (QNodeNotFoundError _ )) -> Right Nothing
       (Left q) -> Left q
       (Right n') -> Right (Just n')