Bläddra i källkod

Use newtype instead of data wherever possible

jherve 1 år sedan
förälder
incheckning
fb0d6b0704

+ 1 - 1
src/LinkedIn/Jobs/JobOffer.purs

@@ -27,7 +27,7 @@ type JobOfferObject = {
   companySize :: Maybe String,
   hasSimplifiedApplicationProcess :: Boolean
 }
-data JobOffer = JobOffer JobOfferObject
+newtype JobOffer = JobOffer JobOfferObject
 
 derive instance Eq JobOffer
 derive instance Generic JobOffer _

+ 1 - 1
src/LinkedIn/Page/JobOffer.purs

@@ -13,7 +13,7 @@ import LinkedIn.Output.Types (Output(..))
 import LinkedIn.UI.Components.JobsUnifiedTopCard (JobsUnifiedTopCardElement)
 import Web.DOM (Document)
 
-data JobOfferPage a = JobOfferPage (JobsUnifiedTopCardElement a)
+newtype JobOfferPage a = JobOfferPage (JobsUnifiedTopCardElement a)
 
 derive instance Generic (JobOfferPage a) _
 derive instance Eq a => Eq (JobOfferPage a)

+ 1 - 1
src/LinkedIn/Page/Projects.purs

@@ -14,7 +14,7 @@ import LinkedIn.Profile.Project as PP
 import LinkedIn.UI.Components.ArtDecoCard (ArtDecoCardElement)
 import Web.DOM (Document)
 
-data ProjectsPage a = ProjectsPage (NonEmptyList (ArtDecoCardElement a))
+newtype ProjectsPage a = ProjectsPage (NonEmptyList (ArtDecoCardElement a))
 
 derive instance Generic (ProjectsPage a) _
 derive instance Eq a => Eq (ProjectsPage a)

+ 1 - 1
src/LinkedIn/Page/Skills.purs

@@ -14,7 +14,7 @@ import LinkedIn.Profile.Skill as PS
 import LinkedIn.UI.Components.ArtDecoTab (ArtDecoTabElement)
 import Web.DOM (Document)
 
-data SkillsPage a = SkillsPage (NonEmptyList (ArtDecoTabElement a))
+newtype SkillsPage a = SkillsPage (NonEmptyList (ArtDecoTabElement a))
 
 derive instance Generic (SkillsPage a) _
 derive instance Eq a => Eq (SkillsPage a)

+ 1 - 1
src/LinkedIn/Page/WorkExperiences.purs

@@ -14,7 +14,7 @@ import LinkedIn.Profile.WorkExperience as PWE
 import LinkedIn.UI.Components.ArtDecoCard (ArtDecoCardElement)
 import Web.DOM (Document)
 
-data WorkExperiencesPage a = WorkExperiencesPage (NonEmptyList (ArtDecoCardElement a))
+newtype WorkExperiencesPage a = WorkExperiencesPage (NonEmptyList (ArtDecoCardElement a))
 
 derive instance Generic (WorkExperiencesPage a) _
 derive instance Eq a => Eq (WorkExperiencesPage a)

+ 1 - 1
src/LinkedIn/Profile/Project.purs

@@ -21,7 +21,7 @@ type ProjectObject = {
   timeSpan :: Maybe TimeSpan,
   description :: Maybe String
 }
-data Project = Project ProjectObject
+newtype Project = Project ProjectObject
 
 derive instance Generic Project _
 derive instance Eq Project

+ 1 - 1
src/LinkedIn/Profile/Skill.purs

@@ -13,7 +13,7 @@ import LinkedIn.UI.Elements.Types (UIElement(..))
 import LinkedIn.UI.Strings.Types (UIString(..))
 
 type SkillObject = { name :: String }
-data Skill = Skill SkillObject
+newtype Skill = Skill SkillObject
 
 derive instance Generic Skill _
 derive instance Eq Skill

+ 1 - 1
src/LinkedIn/Profile/WorkExperience.purs

@@ -26,7 +26,7 @@ type WorkExperienceObject = {
   duration :: Maybe Duration,
   description :: Maybe String
 }
-data WorkExperience = WorkExperience WorkExperienceObject
+newtype WorkExperience = WorkExperience WorkExperienceObject
 
 derive instance Generic WorkExperience _
 derive instance Eq WorkExperience

+ 5 - 5
src/LinkedIn/UI/Components/ArtDeco.purs

@@ -18,17 +18,17 @@ import LinkedIn.Queryable (class Queryable)
 import Type.Proxy (Proxy(..))
 
 type ArtDecoPvsEntityObject a = { side :: Unit, center :: ArtDecoCenter a }
-data ArtDecoPvsEntity a = ArtDecoPvsEntity (ArtDecoPvsEntityObject a)
+newtype ArtDecoPvsEntity a = ArtDecoPvsEntity (ArtDecoPvsEntityObject a)
 
 type ArtDecoCenterObject a = { header :: ArtDecoCenterHeader a, content :: ArtDecoCenterContent a}
-data ArtDecoCenter a = ArtDecoCenter (ArtDecoCenterObject a)
+newtype ArtDecoCenter a = ArtDecoCenter (ArtDecoCenterObject a)
 
 type ArtDecoCenterHeaderObject a = { bold :: a, normal :: Maybe a, light :: List a}
-data ArtDecoCenterHeader a = ArtDecoCenterHeader (ArtDecoCenterHeaderObject a)
+newtype ArtDecoCenterHeader a = ArtDecoCenterHeader (ArtDecoCenterHeaderObject a)
 
-data ArtDecoCenterContent a = ArtDecoCenterContent (NonEmptyList (ArtDecoPvsEntitySubComponent a))
+newtype ArtDecoCenterContent a = ArtDecoCenterContent (NonEmptyList (ArtDecoPvsEntitySubComponent a))
 
-data ArtDecoPvsEntitySubComponent a = ArtDecoPvsEntitySubComponent a
+newtype ArtDecoPvsEntitySubComponent a = ArtDecoPvsEntitySubComponent a
 
 
 derive instance Generic (ArtDecoPvsEntitySubComponent a) _

+ 1 - 1
src/LinkedIn/UI/Components/ArtDecoCard.purs

@@ -17,7 +17,7 @@ import LinkedIn.UI.Components.ArtDeco (ArtDecoPvsEntity, _pvs_to_header_bold, _p
 import Type.Proxy (Proxy(..))
 
 type ArtDecoCardElementObject a = { pvs_entity :: ArtDecoPvsEntity a }
-data ArtDecoCardElement a = ArtDecoCardElement (ArtDecoCardElementObject a)
+newtype ArtDecoCardElement a = ArtDecoCardElement (ArtDecoCardElementObject a)
 
 derive instance Generic (ArtDecoCardElement a) _
 derive instance Eq a => Eq (ArtDecoCardElement a)

+ 1 - 1
src/LinkedIn/UI/Components/ArtDecoTab.purs

@@ -18,7 +18,7 @@ import Type.Proxy (Proxy(..))
 
 
 type ArtDecoTabElementObject a = { pvs_entity :: ArtDecoPvsEntity a }
-data ArtDecoTabElement a = ArtDecoTabElement (ArtDecoTabElementObject a)
+newtype ArtDecoTabElement a = ArtDecoTabElement (ArtDecoTabElementObject a)
 
 derive instance Generic (ArtDecoTabElement a) _
 derive instance Eq a => Eq (ArtDecoTabElement a)

+ 3 - 3
src/LinkedIn/UI/Components/JobsUnifiedTopCard.purs

@@ -25,13 +25,13 @@ type JobsUnifiedTopCardElementObject a = {
   insights :: List (TopCardInsight a),
   actions :: List (TopCardAction a)
 }
-data JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement (JobsUnifiedTopCardElementObject a)
+newtype JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement (JobsUnifiedTopCardElementObject a)
 
 type TopCardPrimaryDescriptionObject a = { link :: a, text :: a, tvmText :: List a }
-data TopCardPrimaryDescription a = TopCardPrimaryDescription (TopCardPrimaryDescriptionObject a)
+newtype TopCardPrimaryDescription a = TopCardPrimaryDescription (TopCardPrimaryDescriptionObject a)
 
 type TopCardInsightObject a = { icon :: a, content :: TopCardInsightContent a }
-data TopCardInsight a = TopCardInsight (TopCardInsightObject a)
+newtype TopCardInsight a = TopCardInsight (TopCardInsightObject a)
 
 data TopCardInsightContent a =
   TopCardInsightContentSingle a