1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Define Listable instances for Return and Empty.

This commit is contained in:
Rob Rix 2017-09-25 19:14:00 -04:00
parent 909e199e72
commit b32a911484

View File

@ -37,8 +37,8 @@ import Data.Record
import Data.Semigroup
import Data.Source
import Data.Span
import qualified Data.Syntax as Syntax (Identifier(..))
import qualified Data.Syntax.Statement as Statement (If(..))
import qualified Data.Syntax as Syntax (Empty(..), Identifier(..))
import qualified Data.Syntax.Statement as Statement (If(..), Return(..))
import Data.Text as T (Text, pack)
import qualified Data.Text.Encoding as T
import Data.These
@ -292,12 +292,18 @@ instance (Listable1 f, Listable1 (Union (g ': fs))) => Listable1 (Union (f ': g
instance Listable1 f => Listable1 (Union '[f]) where
liftTiers tiers = inj `mapT` ((liftTiers :: [Tier a] -> [Tier (f a)]) tiers)
instance Listable1 Syntax.Identifier where
liftTiers _ = cons1 Syntax.Identifier
instance Listable1 Statement.If where
liftTiers tiers = liftCons3 tiers tiers tiers Statement.If
instance Listable1 Statement.Return where
liftTiers tiers = liftCons1 tiers Statement.Return
instance Listable1 Syntax.Empty where
liftTiers _ = cons0 Syntax.Empty
instance Listable1 Syntax.Identifier where
liftTiers _ = cons1 Syntax.Identifier
instance Listable1 Gram where
liftTiers tiers = liftCons2 (liftTiers (liftTiers tiers)) (liftTiers (liftTiers tiers)) Gram