Selaa lähdekoodia

Derive functor instances for topcard

jherve 1 vuosi sitten
vanhempi
commit
84c839e7f6
1 muutettua tiedostoa jossa 6 lisäystä ja 24 poistoa
  1. 6 24
      src/LinkedIn/JobsUnifiedTopCard.purs

+ 6 - 24
src/LinkedIn/JobsUnifiedTopCard.purs

@@ -47,55 +47,37 @@ derive instance Generic (JobsUnifiedTopCardElement a) _
 derive instance Eq a => Eq (JobsUnifiedTopCardElement a)
 instance Show a => Show (JobsUnifiedTopCardElement a) where
   show = genericShow
-instance Functor JobsUnifiedTopCardElement where
-  map f (JobsUnifiedTopCardElement {header, primaryDescription, insights, actions}) =
-    JobsUnifiedTopCardElement {
-      header: f header,
-      primaryDescription: map f primaryDescription,
-      insights: map (map (map f)) insights,
-      actions: map (map (map f)) actions
-    }
+derive instance Functor JobsUnifiedTopCardElement
 
 derive instance Generic (TopCardPrimaryDescription a) _
 derive instance Eq a => Eq (TopCardPrimaryDescription a)
 instance Show a => Show (TopCardPrimaryDescription a) where
   show = genericShow
-instance Functor TopCardPrimaryDescription where
-  map f (TopCardPrimaryDescription {link, text, tvmText}) =
-    TopCardPrimaryDescription {link: f link, text: f text, tvmText: map (map f) tvmText}
+derive instance Functor TopCardPrimaryDescription
 
 derive instance Generic (TopCardInsight a) _
 derive instance Eq a => Eq (TopCardInsight a)
 instance Show a => Show (TopCardInsight a) where
   show = genericShow
-instance Functor TopCardInsight where
-  map f (TopCardInsight {icon, content}) =
-    TopCardInsight {icon: f icon, content: map f content}
+derive instance Functor TopCardInsight
 
 derive instance Generic (TopCardInsightContent a) _
 derive instance Eq a => Eq (TopCardInsightContent a)
 instance Show a => Show (TopCardInsightContent a) where
   show = genericShow
-instance Functor TopCardInsightContent where
-  map f (TopCardInsightContentSingle c) = TopCardInsightContentSingle (f c)
-  map f (TopCardInsightContentSecondary {primary, secondary}) =
-    TopCardInsightContentSecondary {primary: f primary, secondary: map (map f) secondary}
-  map f (TopCardInsightContentButton c) = TopCardInsightContentButton (f c)
+derive instance Functor TopCardInsightContent
 
 derive instance Generic (TopCardSecondaryInsight a) _
 derive instance Eq a => Eq (TopCardSecondaryInsight a)
 instance Show a => Show (TopCardSecondaryInsight a) where
   show = genericShow
-instance Functor TopCardSecondaryInsight where
-  map f (TopCardSecondaryInsightNested c) = TopCardSecondaryInsightNested (f c)
-  map f (TopCardSecondaryInsightPlain c) = TopCardSecondaryInsightPlain (f c)
+derive instance Functor TopCardSecondaryInsight
 
 derive instance Generic (TopCardAction a) _
 derive instance Eq a => Eq (TopCardAction a)
 instance Show a => Show (TopCardAction a) where
   show = genericShow
-instance Functor TopCardAction where
-  map f (TopCardActionApplyButton c) = TopCardActionApplyButton (f c)
+derive instance Functor TopCardAction
 
 parseTopCardAction :: Parser (TopCardAction DetachedNode)
 parseTopCardAction n = do