1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Revert "Don’t specialize null for Exports."

This reverts commit 8f626b6c0f90af595f510543b15400219e5d9102.
This commit is contained in:
Rob Rix 2018-05-07 14:13:11 -04:00
parent 676f905468
commit 05999e7559
2 changed files with 6 additions and 2 deletions

View File

@ -117,8 +117,8 @@ load name = askModuleTable >>= maybeM notFound . ModuleTable.lookup name >>= run
-- languages. We need better semantics rather than doing it ad-hoc.
filterEnv :: Exports.Exports l a -> Environment l a -> Environment l a
filterEnv ports env
| null ports = env
| otherwise = Exports.toEnvironment ports `mergeEnvs` overwrite (Exports.aliases ports) env
| Exports.null ports = env
| otherwise = Exports.toEnvironment ports `mergeEnvs` overwrite (Exports.aliases ports) env
newtype Merging m location value = Merging { runMerging :: m (Maybe (Environment location value, value)) }

View File

@ -3,6 +3,7 @@ module Data.Abstract.Exports
( Exports
, aliases
, insert
, null
, toEnvironment
) where
@ -18,6 +19,9 @@ import Data.Semilattice.Lower
newtype Exports l a = Exports { unExports :: Map.Map Name (Name, Maybe (Address l a)) }
deriving (Eq, Foldable, Functor, Generic1, Lower, Monoid, Ord, Semigroup, Show, Traversable)
null :: Exports l a -> Bool
null = Map.null . unExports
toEnvironment :: Exports l a -> Environment l a
toEnvironment exports = unpairs (mapMaybe collectExport (toList (unExports exports)))
where