-- | Given a function to produce a source of a's (that can be encoded as JSON).
-- Respond with this source
respondWithSource          :: ToJSON a
                           => Handler (Source Handler a) -> Handler TypedContent
respondWithSource mkSource = do
                               s <- mkSource
                               respondSource typePlain
                                 (s $= C.map encode $= awaitForever sendChunk')
    where
      sendChunk' x = sendChunk x >> sendFlush

--------------------------------------------------------------------------------
respondWithSource          :: ToJSON a
                           => Handler (Source Handler a) -> Handler TypedContent
respondWithSource mkSource = do
                               s <- mkSource
                               respondSource typePlain
                                 (s $= C.map encode $= awaitForever sendChunk')
    where
      sendChunk' x = sendChunk x >> sendFlush

--------------------------------------------------------------------------------
respondWithSource mkSource = do
                               s <- mkSource
                               respondSource typePlain
                                 (s $= C.map encode $= awaitForever sendChunk')
    where
      sendChunk' x = sendChunk x >> sendFlush

--------------------------------------------------------------------------------