@@ -41,7 +41,7 @@ import qualified Data.ByteString as B
41
41
import qualified Data.ByteString.Builder as BB
42
42
import qualified Data.ByteString.Char8 as BC8
43
43
import qualified Data.ByteString.Lazy as BL
44
- import Data.Constraint (Constraint , Dict (.. ))
44
+ import Data.Constraint (Dict (.. ))
45
45
import Data.Either
46
46
(partitionEithers )
47
47
import Data.Maybe
@@ -56,7 +56,7 @@ import qualified Data.Text as T
56
56
import Data.Typeable
57
57
import GHC.Generics
58
58
import GHC.TypeLits
59
- (KnownNat , KnownSymbol , TypeError , symbolVal )
59
+ (KnownNat , KnownSymbol , symbolVal )
60
60
import qualified Network.HTTP.Media as NHM
61
61
import Network.HTTP.Types hiding
62
62
(Header , ResponseHeaders )
@@ -90,7 +90,6 @@ import Servant.API.ResponseHeaders
90
90
import Servant.API.Status
91
91
(statusFromNat )
92
92
import qualified Servant.Types.SourceT as S
93
- import Servant.API.TypeErrors
94
93
import Web.HttpApiData
95
94
(FromHttpApiData , parseHeader , parseQueryParam , parseUrlPiece ,
96
95
parseUrlPieces )
@@ -106,8 +105,6 @@ import Servant.Server.Internal.RouteResult
106
105
import Servant.Server.Internal.RoutingApplication
107
106
import Servant.Server.Internal.ServerError
108
107
109
- import GHC.TypeLits
110
- (ErrorMessage (.. ))
111
108
import Servant.API.TypeLevel
112
109
(AtLeastOneFragment , FragmentUnique )
113
110
@@ -814,59 +811,6 @@ instance (HasContextEntry context (NamedContext name subContext), HasServer subA
814
811
815
812
hoistServerWithContext _ _ nt s = hoistServerWithContext (Proxy :: Proxy subApi ) (Proxy :: Proxy subContext ) nt s
816
813
817
- -------------------------------------------------------------------------------
818
- -- Custom type errors
819
- -------------------------------------------------------------------------------
820
-
821
- -- Erroring instance for 'HasServer' when a combinator is not fully applied
822
- instance TypeError (PartialApplication HasServer arr ) => HasServer ((arr :: a -> b ) :> sub ) context
823
- where
824
- type ServerT (arr :> sub ) _ = TypeError (PartialApplication (HasServer :: * -> [* ] -> Constraint ) arr )
825
- route = error " unreachable"
826
- hoistServerWithContext _ _ _ _ = error " unreachable"
827
-
828
- -- | This instance prevents from accidentally using '->' instead of ':>'
829
- --
830
- -- >>> serve (Proxy :: Proxy (Capture "foo" Int -> Get '[JSON] Int)) (error "...")
831
- -- ...
832
- -- ...No instance HasServer (a -> b).
833
- -- ...Maybe you have used '->' instead of ':>' between
834
- -- ...Capture' '[] "foo" Int
835
- -- ...and
836
- -- ...Verb 'GET 200 '[JSON] Int
837
- -- ...
838
- --
839
- -- >>> undefined :: Server (Capture "foo" Int -> Get '[JSON] Int)
840
- -- ...
841
- -- ...No instance HasServer (a -> b).
842
- -- ...Maybe you have used '->' instead of ':>' between
843
- -- ...Capture' '[] "foo" Int
844
- -- ...and
845
- -- ...Verb 'GET 200 '[JSON] Int
846
- -- ...
847
- --
848
- instance TypeError (HasServerArrowTypeError a b ) => HasServer (a -> b ) context
849
- where
850
- type ServerT (a -> b ) m = TypeError (HasServerArrowTypeError a b )
851
- route _ _ _ = error " servant-server panic: impossible happened in HasServer (a -> b)"
852
- hoistServerWithContext _ _ _ = id
853
-
854
- type HasServerArrowTypeError a b =
855
- 'Text " No instance HasServer (a -> b)."
856
- ':$$: 'Text " Maybe you have used '->' instead of ':>' between "
857
- ':$$: 'ShowType a
858
- ':$$: 'Text " and"
859
- ':$$: 'ShowType b
860
-
861
- -- Erroring instances for 'HasServer' for unknown API combinators
862
-
863
- -- XXX: This omits the @context@ parameter, e.g.:
864
- --
865
- -- "There is no instance for HasServer (Bool :> …)". Do we care ?
866
- instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub HasServer ty ) => HasServer (ty :> sub ) context
867
-
868
- instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasServer api context )) => HasServer api context
869
-
870
814
-- | Ignore @'Fragment'@ in server handlers.
871
815
-- See <https://ietf.org/rfc/rfc2616.html#section-15.1.3> for more details.
872
816
--
0 commit comments