From 385e15fc22f48a1f8d40b8263a54155fdab499ea Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 17 Apr 2024 01:21:33 +0200 Subject: replace protocol-buffers with proto-lens I do not really like either option, but at least the second one seems more likely to be maintained (and a little less clunky to use, too, for what it's worth). --- gtfs/Servant/GTFS/Realtime.hs | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 gtfs/Servant/GTFS/Realtime.hs (limited to 'gtfs/Servant/GTFS/Realtime.hs') diff --git a/gtfs/Servant/GTFS/Realtime.hs b/gtfs/Servant/GTFS/Realtime.hs deleted file mode 100644 index 8923b92..0000000 --- a/gtfs/Servant/GTFS/Realtime.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE UndecidableInstances #-} - - -module Servant.GTFS.Realtime (Proto) where - -import Servant - ( MimeRender(..), - MimeUnrender(mimeUnrender), - Accept(contentType), - Proxy(Proxy) ) -import Text.ProtocolBuffers - ( Wire, ReflectDescriptor, messagePut, messageGet ) -import Network.HTTP.Media ((//)) -import Data.Either.Combinators (mapRight) -import Data.Swagger (ToSchema(..)) - - --- | A servant encoding for protobuf-encoded messages -data Proto - -instance Accept Proto where - contentType _ = "application" // "octet-stream" - -instance (Wire msg, ReflectDescriptor msg) => MimeUnrender Proto msg where - mimeUnrender _ = mapRight fst . messageGet @msg - -instance (Wire msg, ReflectDescriptor msg) => MimeRender Proto msg where - mimeRender _ = messagePut - --- TODO: this instance is horrible; ideally it should at least include --- the name of the message type (if at all possible) -instance {-# OVERLAPPABLE #-} Wire msg => ToSchema msg where - declareNamedSchema _ = declareNamedSchema (Proxy @String) -- cgit v1.2.3