mirror of
https://github.com/github/semantic.git
synced 2024-11-30 14:47:30 +03:00
Add use pure and use extract cases to HLint
This commit is contained in:
parent
a2c76a0ddc
commit
500b751503
3
HLint.hs
3
HLint.hs
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user