소스 검색

Reduce visual bloat by writing "instance where" in one line where possible

jherve 1 년 전
부모
커밋
5aca1ea84d

+ 2 - 4
src/LinkedIn.purs

@@ -31,10 +31,8 @@ data APIError =
   | ErrorUnexpectedUrl
 
 derive instance Generic APIError _
-instance Show APIError where
-  show = genericShow
-instance EncodeJson APIError where
-  encodeJson a = genericEncodeJson a
+instance Show APIError where show = genericShow
+instance EncodeJson APIError where encodeJson a = genericEncodeJson a
 
 getContext ∷ Document → Effect (Either APIError PageUrl)
 getContext = runExceptT <<< getContext'

+ 1 - 2
src/LinkedIn/DetachedNode.purs

@@ -37,8 +37,7 @@ data DetachedNode =
 
 derive instance Generic DetachedNode _
 derive instance Eq DetachedNode
-instance Show DetachedNode where
-  show = genericShow
+instance Show DetachedNode where show = genericShow
 
 toDetached :: Node -> Effect DetachedNode
 toDetached node = unsafePartial $ toDetached' (nodeType node) node where

+ 2 - 4
src/LinkedIn/Jobs/JobOffer.purs

@@ -30,10 +30,8 @@ data JobOffer = JobOffer {
 
 derive instance Eq JobOffer
 derive instance Generic JobOffer _
-instance Show JobOffer where
-  show = genericShow
-instance EncodeJson JobOffer where
-  encodeJson a = genericEncodeJson a
+instance Show JobOffer where show = genericShow
+instance EncodeJson JobOffer where encodeJson a = genericEncodeJson a
 
 fromUI ∷ JobsUnifiedTopCardElement UIElement → Either String JobOffer
 fromUI card = ado

+ 4 - 8
src/LinkedIn/Output/Types.purs

@@ -22,10 +22,8 @@ data Output =
 
 derive instance Generic Output _
 derive instance Eq Output
-instance Show Output where
-  show = genericShow
-instance EncodeJson Output where
-  encodeJson a = genericEncodeJson a
+instance Show Output where show = genericShow
+instance EncodeJson Output where encodeJson a = genericEncodeJson a
 
 
 data OutputError =
@@ -36,7 +34,5 @@ data OutputError =
 
 derive instance Generic OutputError _
 derive instance Eq OutputError
-instance Show OutputError where
-  show = genericShow
-instance EncodeJson OutputError where
-  encodeJson a = genericEncodeJson a
+instance Show OutputError where show = genericShow
+instance EncodeJson OutputError where encodeJson a = genericEncodeJson a

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

@@ -17,8 +17,7 @@ data JobOfferPage a = JobOfferPage (JobsUnifiedTopCardElement a)
 
 derive instance Generic (JobOfferPage a) _
 derive instance Eq a => Eq (JobOfferPage a)
-instance Show a => Show (JobOfferPage a) where
-  show = genericShow
+instance Show a => Show (JobOfferPage a) where show = genericShow
 derive instance Functor JobOfferPage
 
 instance Foldable JobOfferPage where

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

@@ -18,8 +18,7 @@ data ProjectsPage a = ProjectsPage (NonEmptyList (ArtDecoCardElement a))
 
 derive instance Generic (ProjectsPage a) _
 derive instance Eq a => Eq (ProjectsPage a)
-instance Show a => Show (ProjectsPage a) where
-  show = genericShow
+instance Show a => Show (ProjectsPage a) where show = genericShow
 derive instance Functor ProjectsPage
 
 instance Foldable ProjectsPage where

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

@@ -18,8 +18,7 @@ data SkillsPage a = SkillsPage (NonEmptyList (ArtDecoTabElement a))
 
 derive instance Generic (SkillsPage a) _
 derive instance Eq a => Eq (SkillsPage a)
-instance Show a => Show (SkillsPage a) where
-  show = genericShow
+instance Show a => Show (SkillsPage a) where show = genericShow
 derive instance Functor SkillsPage
 
 instance Foldable SkillsPage where

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

@@ -18,8 +18,7 @@ data WorkExperiencesPage a = WorkExperiencesPage (NonEmptyList (ArtDecoCardEleme
 
 derive instance Generic (WorkExperiencesPage a) _
 derive instance Eq a => Eq (WorkExperiencesPage a)
-instance Show a => Show (WorkExperiencesPage a) where
-  show = genericShow
+instance Show a => Show (WorkExperiencesPage a) where show = genericShow
 derive instance Functor WorkExperiencesPage
 
 instance Foldable WorkExperiencesPage where

+ 2 - 4
src/LinkedIn/PageUrl.purs

@@ -29,10 +29,8 @@ data PageUrl =
 
 derive instance Eq PageUrl
 derive instance Generic PageUrl _
-instance Show PageUrl where
-  show = genericShow
-instance EncodeJson PageUrl where
-  encodeJson a = genericEncodeJson a
+instance Show PageUrl where show = genericShow
+instance EncodeJson PageUrl where encodeJson a = genericEncodeJson a
 
 pathComponentP :: String -> Parser String Unit
 pathComponentP s = do

+ 2 - 4
src/LinkedIn/Profile/Project.purs

@@ -24,10 +24,8 @@ data Project = Project {
 
 derive instance Generic Project _
 derive instance Eq Project
-instance Show Project where
-  show = genericShow
-instance EncodeJson Project where
-  encodeJson a = genericEncodeJson a
+instance Show Project where show = genericShow
+instance EncodeJson Project where encodeJson a = genericEncodeJson a
 
 fromUI ∷ ArtDecoCardElement UIElement → Either String Project
 fromUI card = ado

+ 2 - 4
src/LinkedIn/Profile/Skill.purs

@@ -18,10 +18,8 @@ data Skill = Skill {
 
 derive instance Generic Skill _
 derive instance Eq Skill
-instance Show Skill where
-  show = genericShow
-instance EncodeJson Skill where
-  encodeJson a = genericEncodeJson a
+instance Show Skill where show = genericShow
+instance EncodeJson Skill where encodeJson a = genericEncodeJson a
 
 fromUI ∷ ArtDecoTabElement UIElement → Either String Skill
 fromUI tab = ado

+ 2 - 4
src/LinkedIn/Profile/WorkExperience.purs

@@ -29,10 +29,8 @@ data WorkExperience = WorkExperience {
 
 derive instance Generic WorkExperience _
 derive instance Eq WorkExperience
-instance Show WorkExperience where
-  show = genericShow
-instance EncodeJson WorkExperience where
-  encodeJson a = genericEncodeJson a
+instance Show WorkExperience where show = genericShow
+instance EncodeJson WorkExperience where encodeJson a = genericEncodeJson a
 
 fromUI ∷ ArtDecoCardElement UIElement → Either String WorkExperience
 fromUI card = ado

+ 3 - 6
src/LinkedIn/QueryRunner.purs

@@ -22,15 +22,12 @@ data QueryError =
   | QNodeUnexpectedType String String
   | QTextNotFoundError
   | QChooseError
-instance EncodeJson QueryError where
-  encodeJson a = genericEncodeJson a
+instance EncodeJson QueryError where encodeJson a = genericEncodeJson a
 
 derive instance Generic QueryError _
 derive instance Eq QueryError
-instance Show QueryError where
-  show = genericShow
-instance Semigroup QueryError where
-  append a _ = a
+instance Show QueryError where show = genericShow
+instance Semigroup QueryError where append a _ = a
 
 type Query q a = q → ExceptT QueryError Effect a
 

+ 8 - 16
src/LinkedIn/UI/Basic/Types.purs

@@ -15,8 +15,7 @@ newtype JobOfferId = JobOfferId Int64
 
 derive instance Eq JobOfferId
 derive instance Generic JobOfferId _
-instance Show JobOfferId where
-  show = genericShow
+instance Show JobOfferId where show = genericShow
 instance EncodeJson JobOfferId where
   encodeJson (JobOfferId a) = encodeNumber $ I64.toNumber a
 
@@ -24,8 +23,7 @@ data MonthYear = MonthYear Month Year
 
 derive instance Eq MonthYear
 derive instance Generic MonthYear _
-instance Show MonthYear where
-  show = genericShow
+instance Show MonthYear where show = genericShow
 instance EncodeJson MonthYear where
   encodeJson _ = encodeString "monthyear" -- TODO
 
@@ -35,10 +33,8 @@ data TimeSpan =
 
 derive instance Eq TimeSpan
 derive instance Generic TimeSpan _
-instance Show TimeSpan where
-  show = genericShow
-instance EncodeJson TimeSpan where
-  encodeJson a = genericEncodeJson a
+instance Show TimeSpan where show = genericShow
+instance EncodeJson TimeSpan where encodeJson a = genericEncodeJson a
 
 data MonthYearOrToday = MY MonthYear | Today
 
@@ -49,16 +45,12 @@ data Duration =
 
 derive instance Eq Duration
 derive instance Generic Duration _
-instance Show Duration where
-  show = genericShow
-instance EncodeJson Duration where
-  encodeJson _ = encodeString "duration" -- TODO
+instance Show Duration where show = genericShow
+instance EncodeJson Duration where encodeJson _ = encodeString "duration" -- TODO
 
 data JobFlexibility = JobFlexHybrid | JobFlexOnSite | JobFlexFullRemote
 
 derive instance Eq JobFlexibility
 derive instance Generic JobFlexibility _
-instance Show JobFlexibility where
-  show = genericShow
-instance EncodeJson JobFlexibility where
-  encodeJson a = genericEncodeJson a
+instance Show JobFlexibility where show = genericShow
+instance EncodeJson JobFlexibility where encodeJson a = genericEncodeJson a

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

@@ -41,8 +41,7 @@ data ArtDecoPvsEntitySubComponent a = ArtDecoPvsEntitySubComponent a
 
 derive instance Generic (ArtDecoPvsEntitySubComponent a) _
 derive instance Eq a => Eq (ArtDecoPvsEntitySubComponent a)
-instance Show a => Show (ArtDecoPvsEntitySubComponent a) where
-  show = genericShow
+instance Show a => Show (ArtDecoPvsEntitySubComponent a) where show = genericShow
 derive instance Functor ArtDecoPvsEntitySubComponent
 
 instance Foldable ArtDecoPvsEntitySubComponent where
@@ -65,8 +64,7 @@ instance Queryable q => CanBeQueried q ArtDecoPvsEntitySubComponent where
 
 derive instance Generic (ArtDecoCenterContent a) _
 derive instance Eq a => Eq(ArtDecoCenterContent a)
-instance Show a => Show(ArtDecoCenterContent a) where
-  show = genericShow
+instance Show a => Show(ArtDecoCenterContent a) where show = genericShow
 derive instance Functor ArtDecoCenterContent
 
 instance Foldable ArtDecoCenterContent where
@@ -89,8 +87,7 @@ instance Queryable q => CanBeQueried q ArtDecoCenterContent where
 
 derive instance Generic (ArtDecoCenterHeader a) _
 derive instance Eq a => Eq(ArtDecoCenterHeader a)
-instance Show a => Show(ArtDecoCenterHeader a) where
-  show = genericShow
+instance Show a => Show(ArtDecoCenterHeader a) where show = genericShow
 derive instance Functor ArtDecoCenterHeader
 
 instance Foldable ArtDecoCenterHeader where
@@ -121,8 +118,7 @@ instance Queryable q => CanBeQueried q ArtDecoCenterHeader where
 
 derive instance Generic (ArtDecoCenter a) _
 derive instance Eq a => Eq(ArtDecoCenter a)
-instance Show a => Show(ArtDecoCenter a) where
-  show = genericShow
+instance Show a => Show(ArtDecoCenter a) where show = genericShow
 derive instance Functor ArtDecoCenter
 
 instance Foldable ArtDecoCenter where
@@ -148,8 +144,7 @@ instance Queryable q => CanBeQueried q ArtDecoCenter where
 
 derive instance Generic (ArtDecoPvsEntity a) _
 derive instance Eq a => Eq(ArtDecoPvsEntity a)
-instance Show a => Show(ArtDecoPvsEntity a) where
-  show = genericShow
+instance Show a => Show(ArtDecoPvsEntity a) where show = genericShow
 derive instance Functor ArtDecoPvsEntity
 
 instance Foldable ArtDecoPvsEntity where

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

@@ -23,8 +23,7 @@ data ArtDecoCardElement a = ArtDecoCardElement {
 
 derive instance Generic (ArtDecoCardElement a) _
 derive instance Eq a => Eq (ArtDecoCardElement a)
-instance Show a => Show (ArtDecoCardElement a) where
-  show = genericShow
+instance Show a => Show (ArtDecoCardElement a) where show = genericShow
 derive instance Functor ArtDecoCardElement
 
 instance Foldable ArtDecoCardElement where

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

@@ -23,8 +23,7 @@ data ArtDecoTabElement a = ArtDecoTabElement {
 
 derive instance Generic (ArtDecoTabElement a) _
 derive instance Eq a => Eq (ArtDecoTabElement a)
-instance Show a => Show (ArtDecoTabElement a) where
-  show = genericShow
+instance Show a => Show (ArtDecoTabElement a) where show = genericShow
 derive instance Functor ArtDecoTabElement
 
 instance Foldable ArtDecoTabElement where

+ 6 - 12
src/LinkedIn/UI/Components/JobsUnifiedTopCard.purs

@@ -52,8 +52,7 @@ data TopCardAction a = TopCardActionButton a
 
 derive instance Generic (JobsUnifiedTopCardElement a) _
 derive instance Eq a => Eq (JobsUnifiedTopCardElement a)
-instance Show a => Show (JobsUnifiedTopCardElement a) where
-  show = genericShow
+instance Show a => Show (JobsUnifiedTopCardElement a) where show = genericShow
 derive instance Functor JobsUnifiedTopCardElement
 
 instance Foldable JobsUnifiedTopCardElement where
@@ -92,8 +91,7 @@ instance Queryable q => CanBeQueried q JobsUnifiedTopCardElement where
 
 derive instance Generic (TopCardPrimaryDescription a) _
 derive instance Eq a => Eq (TopCardPrimaryDescription a)
-instance Show a => Show (TopCardPrimaryDescription a) where
-  show = genericShow
+instance Show a => Show (TopCardPrimaryDescription a) where show = genericShow
 derive instance Functor TopCardPrimaryDescription
 
 instance Foldable TopCardPrimaryDescription where
@@ -121,8 +119,7 @@ instance Queryable q => CanBeQueried q TopCardPrimaryDescription where
 
 derive instance Generic (TopCardInsight a) _
 derive instance Eq a => Eq (TopCardInsight a)
-instance Show a => Show (TopCardInsight a) where
-  show = genericShow
+instance Show a => Show (TopCardInsight a) where show = genericShow
 derive instance Functor TopCardInsight
 
 instance Foldable TopCardInsight where
@@ -148,8 +145,7 @@ instance Queryable q => CanBeQueried q TopCardInsight where
 
 derive instance Generic (TopCardInsightContent a) _
 derive instance Eq a => Eq (TopCardInsightContent a)
-instance Show a => Show (TopCardInsightContent a) where
-  show = genericShow
+instance Show a => Show (TopCardInsightContent a) where show = genericShow
 derive instance Functor TopCardInsightContent
 
 instance Foldable TopCardInsightContent where
@@ -197,8 +193,7 @@ instance Queryable q => CanBeQueried q TopCardInsightContent where
 
 derive instance Generic (TopCardSecondaryInsight a) _
 derive instance Eq a => Eq (TopCardSecondaryInsight a)
-instance Show a => Show (TopCardSecondaryInsight a) where
-  show = genericShow
+instance Show a => Show (TopCardSecondaryInsight a) where show = genericShow
 derive instance Functor TopCardSecondaryInsight
 
 instance Foldable TopCardSecondaryInsight where
@@ -227,8 +222,7 @@ instance Queryable q => CanBeQueried q TopCardSecondaryInsight where
 
 derive instance Generic (TopCardAction a) _
 derive instance Eq a => Eq (TopCardAction a)
-instance Show a => Show (TopCardAction a) where
-  show = genericShow
+instance Show a => Show (TopCardAction a) where show = genericShow
 derive instance Functor TopCardAction
 
 instance Foldable TopCardAction where

+ 1 - 2
src/LinkedIn/UI/Elements/Types.purs

@@ -15,5 +15,4 @@ data UIElement =
   | UIImage String
 
 derive instance Generic UIElement _
-instance Show UIElement where
-  show = genericShow
+instance Show UIElement where show = genericShow

+ 1 - 2
src/LinkedIn/UI/Strings/Types.purs

@@ -16,5 +16,4 @@ data UIString =
 
 derive instance Eq UIString
 derive instance Generic UIString _
-instance Show UIString where
-  show u = genericShow u
+instance Show UIString where show u = genericShow u