1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Merge branch 'master' into indexer-prototype

This commit is contained in:
Josh Vera 2019-01-14 13:24:15 -05:00 committed by GitHub
commit 25f0adc9cd
3 changed files with 8 additions and 3 deletions

View File

@ -67,6 +67,8 @@
# Conveniences
- warning: {lhs: maybe a pure, rhs: maybeM a, name: Use maybeM}
- warning: {lhs: either (const a) id, rhs: fromRight a, name: use fromRight}
- warning: {lhs: either id (const a), rhs: fromLeft a, name: use fromRight}
# Applicative style
- warning: {lhs: f <$> pure a <*> b, rhs: f a <$> b, name: Avoid redundant pure}

View File

@ -2,21 +2,23 @@
module Data.ImportPath (IsRelative(..), ImportPath(..), importPath, toName, defaultAlias) where
import Prologue
import Data.Aeson
import qualified Data.Text as T
import Data.Abstract.Name
import Proto3.Suite
import qualified Proto3.Wire.Decode as Decode
import qualified Proto3.Wire.Encode as Encode
import Data.Abstract.Path (stripQuotes)
import System.FilePath.Posix
import Data.Abstract.Name
import Data.Abstract.Path (stripQuotes)
data IsRelative = Unknown | Relative | NonRelative
deriving (Bounded, Enum, Finite, MessageField, Named, Eq, Generic, Hashable, Ord, Show, ToJSON, NFData)
instance Primitive IsRelative where
encodePrimitive = Encode.enum
decodePrimitive = either (const def) id <$> Decode.enum
decodePrimitive = fromRight def <$> Decode.enum
primType _ = Named (Single (nameOf (Proxy @IsRelative)))
instance HasDefault IsRelative where

View File

@ -17,6 +17,7 @@ import Data.ByteString as X (ByteString)
import Data.Coerce as X
import Data.Int as X (Int8, Int16, Int32, Int64)
import Data.Functor.Both as X (Both (Both), runBothWith)
import Data.Either as X (fromLeft, fromRight)
import Data.IntMap as X (IntMap)
import Data.IntSet as X (IntSet)
import Data.Ix as X (Ix (..))