@@ -18,6 +18,7 @@ import Data.Binary (Binary)
1818import Data.Coerce (coerce)
1919import Data.Data
2020import Data.Hashable (Hashable)
21+import Data.OpenApi
2122import Data.String
2223import Data.Text as T
2324import Data.UUID (UUID)
@@ -25,13 +26,11 @@ import qualified Data.UUID as UUID
2526import qualified Data.UUID.V4 as UUID.V4
2627import GHC.TypeLits
2728import Prelude as P
29+import Test.QuickCheck
2830import Text.ParserCombinators.ReadP
2931import Web.HttpApiData
3032import Web.PathPieces (PathPiece(..))
3133
32−#ifdef BACKEND
33−import Data.OpenApi
34−import Test.QuickCheck
3534#ifdef USE_CASSAVA
3635import Data.Csv as Csv hiding(Name)
3736#endif
@@ -39,7 +38,6 @@ import Data.Csv as Csv hiding(Name)
3938import Database.PostgreSQL.Simple.FromField as PG (FromField)
4039import Database.PostgreSQL.Simple.ToField as PG (ToField)
4140#endif
42−#endif
4341
4442#ifdef USE_FLAT
4543import Flat as F
@@ -57,11 +55,9 @@ newtype Id t = Id { unId :: UUID }
5755 , PG.ToField, PG.FromField
5856#endif
5957#endif
60− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey
61−#ifdef BACKEND
62− , ToSchema, ToParamSchema
63−#endif
64− , FromHttpApiData, ToHttpApiData )
58+ , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
59+ , ToParamSchema, FromHttpApiData, ToHttpApiData
60+ )
6561
6662type role Id nominal
6763
@@ -97,14 +93,12 @@ instance Data.Store.Store (Id s) where
9793 size = Data.Store.ConstSize 16
9894#endif
9995
100−#ifdef BACKEND
10196instance Arbitrary (Id t) where
10297 arbitrary = fmap Id $ UUID.fromWords
10398 <$> arbitrary
10499 <*> arbitrary
105100 <*> arbitrary
106101 <*> arbitrary
107−#endif
108102
109103instance PathPiece (Id t) where
110104 fromPathPiece = coerce . UUID.fromText
@@ -159,11 +153,10 @@ newtype IntId t = IntId { unIntId :: Integer }
159153#ifdef USE_STORE
160154 , Data.Store.Store
161155#endif
162−#ifdef BACKEND
163− , ToSchema, ToParamSchema, Arbitrary
164−#endif
165− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, FromHttpApiData
166− , ToHttpApiData, PathPiece, Num, Integral, Real, Enum )
156+ , ToSchema, ToParamSchema, Arbitrary, FromJSON, ToJSON, NFData, Hashable
157+ , FromJSONKey, ToJSONKey, FromHttpApiData, ToHttpApiData, PathPiece, Num
158+ , Integral, Real, Enum
159+ )
167160
168161type role IntId nominal
169162
@@ -210,11 +203,10 @@ newtype Name t = Name { unName :: Text }
210203#ifdef USE_STORE
211204 , Data.Store.Store
212205#endif
213−#ifdef BACKEND
214− , ToSchema, ToParamSchema
215−#endif
216− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, FromHttpApiData
217− , ToHttpApiData, PathPiece, IsString, Semigroup, Monoid )
206+ , ToSchema, ToParamSchema, FromJSON, ToJSON, NFData, Hashable, FromJSONKey
207+ , ToJSONKey, FromHttpApiData, ToHttpApiData, PathPiece, IsString, Semigroup
208+ , Monoid
209+ )
218210
219211type role Name nominal
220212
@@ -232,10 +224,8 @@ instance KnownSymbol s => Read (Name s) where
232224 _ <- string ("Name-" <> symbolVal (Proxy @s) <> "-")
233225 mkName <$> readS_to_P reads
234226
235−#ifdef BACKEND
236227instance Arbitrary (Name s) where
237228 arbitrary = coerce . T.pack . getPrintableString <$> arbitrary
238−#endif
239229
240230-- | This is a more \"explicit\" 'coerce' specifically for 'Name'.
241231-- You are forced to explicitly specify the phantom types you are converting