1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Add use pure and use extract cases to HLint

This commit is contained in:
joshvera 2016-05-26 14:53:12 -04:00
parent a2c76a0ddc
commit 500b751503
2 changed files with 4 additions and 1 deletions

View File

@ -8,3 +8,6 @@ error "generalize forM_" = forM_ ==> for_
error "Avoid return" =
return ==> pure
where note = "return is obsolete as of GHC 7.10"
error "use pure" = free . Pure ==> pure
error "use extract" = headF . runCofree ==> extract

View File

@ -40,7 +40,7 @@ isFixed = not . Set.null . Set.intersection fixedCategories
-- | Given a function that maps production names to sets of categories, produce
-- | a Constructor.
termConstructor :: (String -> Set.Set Category) -> Constructor
termConstructor mapping source range name children = cofree (Info range categories (1 + sum (size . headF . runCofree <$> children)) :< construct children)
termConstructor mapping source range name children = cofree (Info range categories (1 + sum (size . extract <$> children)) :< construct children)
where
categories = mapping name
construct :: [Term Text Info] -> Syntax Text (Term Text Info)