Bläddra i källkod

Functor instances can be derived

jherve 1 år sedan
förälder
incheckning
c7fe6844dc
3 ändrade filer med 8 tillägg och 24 borttagningar
  1. 5 18
      src/LinkedIn/ArtDeco.purs
  2. 2 3
      src/LinkedIn/ArtDecoCard.purs
  3. 1 3
      src/LinkedIn/ArtDecoTab.purs

+ 5 - 18
src/LinkedIn/ArtDeco.purs

@@ -42,44 +42,31 @@ derive instance Generic (ArtDecoPvsEntitySubComponent a) _
 derive instance Eq a => Eq (ArtDecoPvsEntitySubComponent a)
 instance Show a => Show (ArtDecoPvsEntitySubComponent a) where
   show = genericShow
-instance Functor ArtDecoPvsEntitySubComponent where
-  map f (ArtDecoPvsEntitySubComponent c) = ArtDecoPvsEntitySubComponent (map f c)
+derive instance Functor ArtDecoPvsEntitySubComponent
 
 derive instance Generic (ArtDecoCenterContent a) _
 derive instance Eq a => Eq(ArtDecoCenterContent a)
 instance Show a => Show(ArtDecoCenterContent a) where
   show = genericShow
-instance Functor ArtDecoCenterContent where
-  map f (ArtDecoCenterContent nel) = ArtDecoCenterContent (map (map f) nel)
+derive instance Functor ArtDecoCenterContent
 
 derive instance Generic (ArtDecoCenterHeader a) _
 derive instance Eq a => Eq(ArtDecoCenterHeader a)
 instance Show a => Show(ArtDecoCenterHeader a) where
   show = genericShow
-instance Functor ArtDecoCenterHeader where
-  map f (ArtDecoCenterHeader {bold, normal, light}) =
-    ArtDecoCenterHeader ({
-      bold: f bold,
-      normal: map f normal,
-      light: map (map f) light
-    })
+derive instance Functor ArtDecoCenterHeader
 
 derive instance Generic (ArtDecoCenter a) _
 derive instance Eq a => Eq(ArtDecoCenter a)
 instance Show a => Show(ArtDecoCenter a) where
   show = genericShow
-instance Functor ArtDecoCenter where
-  map f (ArtDecoCenter {content, header}) =
-    ArtDecoCenter ({content: map f content, header: map f header})
+derive instance Functor ArtDecoCenter 
 
 derive instance Generic (ArtDecoPvsEntity a) _
 derive instance Eq a => Eq(ArtDecoPvsEntity a)
 instance Show a => Show(ArtDecoPvsEntity a) where
   show = genericShow
-instance Functor ArtDecoPvsEntity where
-  map f (ArtDecoPvsEntity {side, center}) =
-    ArtDecoPvsEntity ({side, center: map f center})
-
+derive instance Functor ArtDecoPvsEntity
 
 parseArtDecoPvsEntitySubComponent ∷ Parser (ArtDecoPvsEntitySubComponent DetachedNode)
 parseArtDecoPvsEntitySubComponent n = do

+ 2 - 3
src/LinkedIn/ArtDecoCard.purs

@@ -12,6 +12,7 @@ import LinkedIn.ArtDeco (ArtDecoPvsEntity, parseArtDecoPvsEntity)
 import LinkedIn.ArtDeco as AD
 import LinkedIn.Types (Parser)
 import LinkedIn.Utils (queryOneAndParse)
+import LinkedIn.QueryRunner (QueryRunner, ignoreNotFound, queryAll, queryOne)
 
 
 data ArtDecoCardElement a = ArtDecoCardElement {
@@ -22,9 +23,7 @@ derive instance Generic (ArtDecoCardElement a) _
 derive instance Eq a => Eq (ArtDecoCardElement a)
 instance Show a => Show (ArtDecoCardElement a) where
   show = genericShow
-instance Functor ArtDecoCardElement where
-  map f (ArtDecoCardElement {pvs_entity}) =
-    ArtDecoCardElement ({pvs_entity: map f pvs_entity})
+derive instance Functor ArtDecoCardElement
 
 parseArtDecoCard :: Parser (ArtDecoCardElement DetachedNode)
 parseArtDecoCard n = do

+ 1 - 3
src/LinkedIn/ArtDecoTab.purs

@@ -22,9 +22,7 @@ derive instance Generic (ArtDecoTabElement a) _
 derive instance Eq a => Eq (ArtDecoTabElement a)
 instance Show a => Show (ArtDecoTabElement a) where
   show = genericShow
-instance Functor ArtDecoTabElement where
-  map f (ArtDecoTabElement {pvs_entity}) =
-    ArtDecoTabElement ({pvs_entity: map f pvs_entity})
+derive instance Functor ArtDecoTabElement
 
 parseArtDecoTab :: Parser (ArtDecoTabElement DetachedNode)
 parseArtDecoTab n = do