module Hreq.Core.API.Response where
import Data.Kind (Type)
import Data.Singletons (Sing, SingI (..))
import GHC.TypeLits (Symbol)
data ResContent a =
ResBody a a
| ResHeaders [(Symbol, a)]
| ResStream a a
| Raw a
type ResBody = 'ResBody
type ResHeaders = 'ResHeaders
type ResStream = 'ResStream
type Raw = 'Raw ()
data SResContent (a :: ResContent Type) where
SResBody :: forall ctyp a. Sing ctyp -> Sing a -> SResContent ('ResBody ctyp a)
SResStream :: forall ctyp a. Sing ctyp -> Sing a -> SResContent ('ResStream ctyp a)
SResHeaders :: forall (ts :: [(Symbol, Type)]). Sing ts -> SResContent ('ResHeaders ts)
SRaw :: forall (a :: Type) . Sing a -> SResContent ('Raw a)
type instance Sing = SResContent
instance (SingI a, SingI ctyp) => SingI ('ResStream ctyp a :: ResContent Type) where
sing = SResStream sing sing
instance (SingI ctyp, SingI a) => SingI ('ResBody ctyp a :: ResContent Type) where
sing = SResBody sing sing
instance SingI ts => SingI ('ResHeaders ts :: ResContent Type) where
sing = SResHeaders sing
instance SingI a => SingI ('Raw a :: ResContent Type) where
sing = SRaw sing