on master help sign in
Merge pull request #671 from reactormonk/typeerror

TypeError annotations for AllCTRender

commit57696dcd6fa1604fd9585b9cd05346dfcfa60d94 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 14 May 2017, 19:38 (9 years ago) parent27facbabbc872e
1 file changed+10
servant/src/Servant/API/ContentTypes.hs+10
servant/src/Servant/API/ContentTypes.hs+10
@@ -98,6 +98,10 @@ import Web.FormUrlEncoded (FromForm, ToForm,
9898import Prelude ()
9999import Prelude.Compat
100100
101+#if MIN_VERSION_base(4,9,0)
102+import qualified GHC.TypeLits as TL
103+#endif
104+
101105-- * Provided content types
102106data JSON deriving Typeable
103107data PlainText deriving Typeable
@@ -182,6 +186,12 @@ instance OVERLAPPABLE_
182186 amrs = allMimeRender pctyps val
183187 lkup = fmap (\(a,b) -> (a, (fromStrict $ M.renderHeader a, b))) amrs
184188
189+#if MIN_VERSION_base(4,9,0)
190+instance TL.TypeError ('TL.Text "No instance for (), use NoContent instead.")
191+ => AllCTRender '[] () where
192+ handleAcceptH _ _ _ = error "unreachable"
193+#endif
194+
185195--------------------------------------------------------------------------
186196-- * Unrender
187197