Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 1bffcb5

Browse files
author
Patrick Thomson
authored
Merge branch 'master' into cache-dist-newstyle
2 parents 497bc50 + 440b182 commit 1bffcb5

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ cabal new-test
108108
cabal new-run semantic -- --help
109109
```
110110

111-
`semantic` requires at least GHC 8.6.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. Our version bounds are based on [Stackage][stackage] LTS versions. The current LTS version is 13.13. `stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability.
111+
`semantic` requires at least GHC 8.6.4 and Cabal 2.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. `stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability.
112112

113113
[nix]: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html
114114
[stackage]: https://stackage.org

src/Data/Language.hs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Data.Char (toUpper)
1717
import Data.String
1818
import qualified Data.Text as T
1919
import Prologue
20-
import Proto3.Suite
2120
import System.FilePath.Posix
2221

2322
-- | The various languages we support.
@@ -37,7 +36,7 @@ data Language
3736
| TypeScript
3837
| PHP
3938
| TSX
40-
deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Named, Enum, MessageField, NFData)
39+
deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Enum, NFData)
4140

4241
class SLanguage (lang :: Language) where
4342
reflect :: proxy lang -> Language
@@ -78,12 +77,6 @@ instance SLanguage 'TypeScript where
7877
instance SLanguage 'PHP where
7978
reflect _ = PHP
8079

81-
82-
-- This ensures that the protobuf file is generated with ALL_CAPS_NAMES.
83-
instance Finite Language where
84-
enumerate _ = fmap go [Unknown ..] where
85-
go x = (fromString (fmap toUpper (show x)), fromEnum x)
86-
8780
instance FromJSON Language where
8881
parseJSON = withText "Language" $ \l ->
8982
pure $ fromMaybe Unknown (parseLanguage l)
@@ -107,18 +100,6 @@ parseLanguage l = case T.toLower l of
107100
knownLanguage :: Language -> Bool
108101
knownLanguage = (/= Unknown)
109102

110-
-- | Defaults to 'Unknown'.
111-
instance HasDefault Language where def = Unknown
112-
113-
-- | Piggybacks on top of the 'Enumerated' instance, as the generated code would.
114-
-- This instance will get easier when we have DerivingVia.
115-
instance Primitive Language where
116-
primType _ = primType (Proxy @(Enumerated Language))
117-
encodePrimitive f = encodePrimitive f . Enumerated . Right
118-
decodePrimitive = decodePrimitive >>= \case
119-
(Enumerated (Right r)) -> pure r
120-
other -> Prelude.fail ("Language decodeMessageField: unexpected value" <> show other)
121-
122103
-- | Returns a Language based on the file extension (including the ".").
123104
languageForType :: String -> Language
124105
languageForType mediaType = case mediaType of

src/Semantic/CLI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE ApplicativeDo, RankNTypes #-}
1+
{-# LANGUAGE ApplicativeDo #-}
22
module Semantic.CLI (main) where
33

44
import Control.Exception as Exc (displayException)

0 commit comments

Comments
 (0)