Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cgi 7.8 ready #7

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 21 additions & 2 deletions Network/CGI/Monad.hs
@@ -1,4 +1,9 @@
{-# OPTIONS_GHC -fglasgow-exts #-}
#if __GLASGOW_HASKELL__ < 708
#else
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Network.CGI.Monad
Expand Down Expand Up @@ -41,7 +46,8 @@ import Control.Monad.Reader (ReaderT(..), asks)
import Control.Monad.Writer (WriterT(..), tell)
import Control.Monad.Trans (MonadTrans, MonadIO, liftIO, lift)
import Data.Typeable (Typeable(..), Typeable1(..),
mkTyConApp, mkTyCon)
mkTyConApp)
import qualified Data.Typeable as T

import Network.CGI.Protocol

Expand All @@ -56,9 +62,22 @@ type CGI a = CGIT IO a
-- | The CGIT monad transformer.
newtype CGIT m a = CGIT { unCGIT :: ReaderT CGIRequest (WriterT Headers m) a }

cgiTyCon :: T.TyCon
#if MIN_VERSION_base(4,4,0)
cgiTyCon = T.mkTyCon3 "cgi" "Network.CGI.Monad" "CGIT"
#else
cgiTyCon = T.mkTyCon "Network.CGI.Monad.CGIT"
#endif
{-# NOINLINE cgiTyCon #-}

#if __GLASGOW_HASKELL__ < 708
instance (Typeable1 m, Typeable a) => Typeable (CGIT m a) where
typeOf _ = mkTyConApp (mkTyCon "Network.CGI.Monad.CGIT")
typeOf _ = mkTyConApp cgiTyCon
[typeOf1 (undefined :: m a), typeOf (undefined :: a)]
#else
deriving instance Typeable CGIT
#endif


instance (Functor m, Monad m) => Functor (CGIT m) where
fmap f c = CGIT (fmap f (unCGIT c))
Expand Down
23 changes: 21 additions & 2 deletions Network/CGI/Protocol.hs
@@ -1,3 +1,8 @@
#if __GLASGOW_HASKELL__ < 708
#else
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Network.CGI.Protocol
Expand Down Expand Up @@ -44,7 +49,8 @@ import System.IO (Handle, hPutStrLn, stderr, hFlush, hSetBinaryMode)
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.ByteString.Lazy.Char8 (ByteString)

import Data.Typeable (Typeable(..), mkTyConApp, mkTyCon)
import Data.Typeable (Typeable(..), mkTyConApp)
import qualified Data.Typeable as T

import Network.CGI.Header
import Network.CGI.Multipart
Expand All @@ -71,9 +77,22 @@ data CGIRequest =
cgiRequestBody :: ByteString
}
deriving (Show)


cgiTyCon :: T.TyCon
#if MIN_VERSION_base(4,4,0)
cgiTyCon = T.mkTyCon3 "cgi" "Network.CGI.Protocol" "CGIResult"
#else
cgiTyCon = T.mkTyCon "Network.CGI.Protocol.CGIResult"
#endif
{-# NOINLINE cgiTyCon #-}

#if __GLASGOW_HASKELL__ < 708
instance Typeable CGIResult where
typeOf _ = mkTyConApp (mkTyCon "Network.CGI.Protocol.CGIResult") []
typeOf _ = mkTyConApp cgiTyCon []
#else
deriving instance Typeable CGIResult
#endif

-- | The value of an input parameter, and some metadata.
data Input = Input {
Expand Down
2 changes: 1 addition & 1 deletion cgi.cabal
@@ -1,5 +1,5 @@
Name: cgi
Version: 3001.1.8.5
Version: 3001.2.8.5
Copyright: Bjorn Bringert, Andy Gill, Anders Kaseorg, Ian Lynagh,
Erik Meijer, Sven Panne, Jeremy Shaw
Category: Network
Expand Down