Use GADTs-style record selectors for Delayed
This commit is contained in:
parent
4f671f1940
commit
738b9a8e9f
1 changed files with 7 additions and 12 deletions
|
@ -1,12 +1,7 @@
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DeriveFunctor #-}
|
{-# LANGUAGE DeriveFunctor #-}
|
||||||
{-# LANGUAGE ExistentialQuantification #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE GADTs #-}
|
{-# LANGUAGE GADTs #-}
|
||||||
{-# LANGUAGE KindSignatures #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE StandaloneDeriving #-}
|
|
||||||
module Servant.Server.Internal.RoutingApplication where
|
module Servant.Server.Internal.RoutingApplication where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
|
@ -154,13 +149,13 @@ toApplication ra request respond = do
|
||||||
-- The accept header check can be performed as the final
|
-- The accept header check can be performed as the final
|
||||||
-- computation in this block. It can cause a 406.
|
-- computation in this block. It can cause a 406.
|
||||||
--
|
--
|
||||||
data Delayed c = forall captures auth body. Delayed
|
data Delayed c where
|
||||||
{ capturesD :: IO (RouteResult captures)
|
Delayed :: { capturesD :: IO (RouteResult captures)
|
||||||
, methodD :: IO (RouteResult ())
|
, methodD :: IO (RouteResult ())
|
||||||
, authD :: IO (RouteResult auth)
|
, authD :: IO (RouteResult auth)
|
||||||
, bodyD :: IO (RouteResult body)
|
, bodyD :: IO (RouteResult body)
|
||||||
, serverD :: (captures -> auth -> body -> RouteResult c)
|
, serverD :: (captures -> auth -> body -> RouteResult c)
|
||||||
}
|
} -> Delayed c
|
||||||
|
|
||||||
instance Functor Delayed where
|
instance Functor Delayed where
|
||||||
fmap f Delayed{..}
|
fmap f Delayed{..}
|
||||||
|
|
Loading…
Reference in a new issue