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

Commit 838f09e

Browse files
author
Patrick Thomson
committed
Remove HasDefault and Primitive instances for Language.
Those instances are handled by the bridged data types in `Semantic.Api`. Keeping this around is both unnecessary and is making #139 go all wobbly for reasons that are still unclear to me.
1 parent e4fdb7f commit 838f09e

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/Data/Language.hs

Lines changed: 0 additions & 13 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.
@@ -107,18 +106,6 @@ parseLanguage l = case T.toLower l of
107106
knownLanguage :: Language -> Bool
108107
knownLanguage = (/= Unknown)
109108

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-
122109
-- | Returns a Language based on the file extension (including the ".").
123110
languageForType :: String -> Language
124111
languageForType mediaType = case mediaType of

0 commit comments

Comments
 (0)