@@ -29,7 +29,7 @@ import Control.Monad.Trans.Except
2929import Data.Aeson
3030import Data.Char
3131import Data.Foldable (forM_)
32−import Data.Monoid
32+import Data.Monoid hiding (getLast)
3333import Data.Proxy
3434import qualified Data.Text as T
3535import GHC.Generics
@@ -166,9 +166,9 @@ sucessSpec = beforeAll (startWaiApp server) $ afterAll endWaiApp $ do
166166 let getDeleteEmpty = getNth (Proxy :: Proxy 1) $ client api baseUrl manager
167167 (left show <$> runExceptT getDeleteEmpty) `shouldReturn` Right ()
168168
169− {-it "allows content type" $ \(_, baseUrl) -> do-}
170− {-let getDeleteContentType = getNth (Proxy :: Proxy 14) $ client api baseUrl manager-}
171− {-(left show <$> runExceptT getDeleteContentType) `shouldReturn` Right ()-}
169+ it "allows content type" $ \(_, baseUrl) -> do
170+ let getDeleteContentType = getLast $ client api baseUrl manager
171+ (left show <$> runExceptT getDeleteContentType) `shouldReturn` Right ()
172172
173173 it "Servant.API.Capture" $ \(_, baseUrl) -> do
174174 let getCapture = getNth (Proxy :: Proxy 2) $ client api baseUrl manager
@@ -350,8 +350,14 @@ class GetNth (n :: Nat) a b | n a -> b where
350350instance GetNth 0 (x :<|> y) x where
351351 getNth _ (x :<|> _) = x
352352
353−{-instance GetNth 0 x x where-}
354− {-getNth _ = id-}
355−
356353instance (GetNth (n - 1) x y) => GetNth n (a :<|> x) y where
357354 getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x
355+
356+class GetLast a b | a -> b where
357+ getLast :: a -> b
358+
359+instance (GetLast b c) => GetLast (a :<|> b) c where
360+ getLast (_ :<|> b) = getLast b
361+
362+instance GetLast a a where
363+ getLast a = a