1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Move the SomeOrigin constructors down next to SomeOrigin.

This commit is contained in:
Rob Rix 2018-04-02 17:36:11 -04:00
parent e03461819c
commit 92116753dd

View File

@ -11,15 +11,6 @@ data Origin term ty where
Module :: Origin term 'P -> M.ModuleInfo -> Origin term 'M
Term :: Origin term 'M -> Base term () -> Origin term 'T
packageOrigin :: P.Package term -> SomeOrigin term
packageOrigin = SomeOrigin . Package . P.packageInfo
moduleOrigin :: M.Module term -> SomeOrigin term
moduleOrigin = SomeOrigin . Module Unknown . M.moduleInfo
termOrigin :: Recursive term => term -> SomeOrigin term
termOrigin = SomeOrigin . Term Unknown . (() <$) . project
originModule :: Origin term ty -> Maybe M.ModuleInfo
originModule (Term o _) = originModule o
originModule (Module _ m) = Just m
@ -62,6 +53,15 @@ data OriginType = P | M | T
data SomeOrigin term where
SomeOrigin :: Origin term ty -> SomeOrigin term
packageOrigin :: P.Package term -> SomeOrigin term
packageOrigin = SomeOrigin . Package . P.packageInfo
moduleOrigin :: M.Module term -> SomeOrigin term
moduleOrigin = SomeOrigin . Module Unknown . M.moduleInfo
termOrigin :: Recursive term => term -> SomeOrigin term
termOrigin = SomeOrigin . Term Unknown . (() <$) . project
withSomeOrigin :: (forall ty . Origin term ty -> b) -> SomeOrigin term -> b
withSomeOrigin with (SomeOrigin o) = with o