@@ -9,12 +9,14 @@ module Servant.Foreign.Internal where
10import Control.Lens (makePrisms, makeLenses, Getter, (&), (<>~), (%~),
10import Control.Lens (makePrisms, makeLenses, Getter, (&), (<>~), (%~),
12+import Data.Data (Data)
12#if !MIN_VERSION_base(4,8,0)
13#if !MIN_VERSION_base(4,8,0)
13import Data.Monoid
14import Data.Monoid
15import Data.Proxy
16import Data.Proxy
16import Data.String
17import Data.String
17import Data.Text
18import Data.Text
19+import Data.Typeable (Typeable)
18import Data.Text.Encoding (decodeUtf8)
20import Data.Text.Encoding (decodeUtf8)
19import GHC.TypeLits
21import GHC.TypeLits
20import qualified Network.HTTP.Types as HTTP
22import qualified Network.HTTP.Types as HTTP
@@ -24,21 +26,19 @@ import Servant.API.TypeLevel
26newtype FunctionName = FunctionName { unFunctionName :: [Text] }
28newtype FunctionName = FunctionName { unFunctionName :: [Text] }
27− deriving (Show, Eq, Monoid)
29+ deriving (Data, Show, Eq, Monoid, Typeable)
29makePrisms ''FunctionName
31makePrisms ''FunctionName
31newtype PathSegment = PathSegment { unPathSegment :: Text }
33newtype PathSegment = PathSegment { unPathSegment :: Text }
32− deriving (Show, Eq, IsString, Monoid)
34+ deriving (Data, Show, Eq, IsString, Monoid, Typeable)
34makePrisms ''PathSegment
36makePrisms ''PathSegment
36data Arg f = Arg
38data Arg f = Arg
37 { _argName :: PathSegment
39 { _argName :: PathSegment
38 , _argType :: f }
40 , _argType :: f }
39−
41+ deriving (Data, Eq, Show, Typeable)
40−deriving instance Eq f => Eq (Arg f)
41−deriving instance Show f => Show (Arg f)
43makeLenses ''Arg
43makeLenses ''Arg
@@ -50,16 +50,12 @@ data SegmentType f
50 -- ^ a static path segment. like "/foo"
50 -- ^ a static path segment. like "/foo"
51 | Cap (Arg f)
51 | Cap (Arg f)
52 -- ^ a capture. like "/:userid"
52 -- ^ a capture. like "/:userid"
53−
53+ deriving (Data, Eq, Show, Typeable)
54−deriving instance Eq f => Eq (SegmentType f)
55−deriving instance Show f => Show (SegmentType f)
57makePrisms ''SegmentType
55makePrisms ''SegmentType
59newtype Segment f = Segment { unSegment :: SegmentType f }
57newtype Segment f = Segment { unSegment :: SegmentType f }
60−
58+ deriving (Data, Eq, Show, Typeable)
61−deriving instance Eq f => Eq (Segment f)
62−deriving instance Show f => Show (Segment f)
64makePrisms ''Segment
60makePrisms ''Segment
@@ -77,7 +73,7 @@ data ArgType
80− deriving (Eq, Show)
76+ deriving (Data, Eq, Show, Typeable)
82makePrisms ''ArgType
78makePrisms ''ArgType
@@ -85,9 +81,7 @@ data QueryArg f = QueryArg
85 { _queryArgName :: Arg f
81 { _queryArgName :: Arg f
86 , _queryArgType :: ArgType
82 , _queryArgType :: ArgType
88−
84+ deriving (Data, Eq, Show, Typeable)
89−deriving instance Eq f => Eq (QueryArg f)
90−deriving instance Show f => Show (QueryArg f)
92makeLenses ''QueryArg
86makeLenses ''QueryArg
@@ -97,9 +91,7 @@ data HeaderArg f = HeaderArg
97 { _headerArg :: Arg f
91 { _headerArg :: Arg f
98 , _headerPattern :: Text
92 , _headerPattern :: Text
100−
94+ deriving (Data, Eq, Show, Typeable)
101−deriving instance Eq f => Eq (HeaderArg f)
102−deriving instance Show f => Show (HeaderArg f)
104makeLenses ''HeaderArg
96makeLenses ''HeaderArg
@@ -109,9 +101,7 @@ data Url f = Url
109 { _path :: Path f
101 { _path :: Path f
110 , _queryStr :: [QueryArg f]
102 , _queryStr :: [QueryArg f]
112−
104+ deriving (Data, Eq, Show, Typeable)
113−deriving instance Eq f => Eq (Url f)
114−deriving instance Show f => Show (Url f)
116defUrl :: Url f
106defUrl :: Url f
117defUrl = Url [] []
107defUrl = Url [] []
@@ -126,9 +116,7 @@ data Req f = Req
126 , _reqReturnType :: Maybe f
116 , _reqReturnType :: Maybe f
127 , _reqFuncName :: FunctionName
117 , _reqFuncName :: FunctionName
129−
119+ deriving (Data, Eq, Show, Typeable)
130−deriving instance Eq f => Eq (Req f)
131−deriving instance Show f => Show (Req f)
133makeLenses ''Req
121makeLenses ''Req