@@ -18,13 +18,20 @@ import Data.Binary (Binary)
1818import Data.Coerce (coerce)
1919import Data.Data
2020import Data.Hashable (Hashable)
21−import Data.OpenApi
2221import Data.String
2322import Data.Text as T
2423import Data.UUID (UUID)
2524import qualified Data.UUID as UUID
2625import qualified Data.UUID.V4 as UUID.V4
27−#ifndef ghcjs_HOST_OS
26+import GHC.TypeLits
27+import Prelude as P
28+import Text.ParserCombinators.ReadP
29+import Web.HttpApiData
30+import Web.PathPieces (PathPiece(..))
31+
32+#ifdef BACKEND
33+import Data.OpenApi
34+import Test.QuickCheck
2835#ifdef USE_CASSAVA
2936import Data.Csv as Csv hiding(Name)
3037#endif
@@ -33,12 +40,7 @@ import Database.PostgreSQL.Simple.FromField as PG (FromField)
3340import Database.PostgreSQL.Simple.ToField as PG (ToField)
3441#endif
3542#endif
36−import GHC.TypeLits
37−import Prelude as P
38−import Test.QuickCheck
39−import Text.ParserCombinators.ReadP
40−import Web.HttpApiData
41−import Web.PathPieces (PathPiece(..))
43+
4244#ifdef USE_FLAT
4345import Flat as F
4446#endif
@@ -55,8 +57,11 @@ newtype Id t = Id { unId :: UUID }
5557 , PG.ToField, PG.FromField
5658#endif
5759#endif
58− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
59− , ToParamSchema, FromHttpApiData, ToHttpApiData )
60+ , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey
61+#ifdef BACKEND
62+ , ToSchema, ToParamSchema
63+#endif
64+ , FromHttpApiData, ToHttpApiData )
6065
6166type role Id nominal
6267
@@ -92,12 +97,14 @@ instance Data.Store.Store (Id s) where
9297 size = Data.Store.ConstSize 16
9398#endif
9499
100+#ifdef BACKEND
95101instance Arbitrary (Id t) where
96102 arbitrary = fmap Id $ UUID.fromWords
97103 <$> arbitrary
98104 <*> arbitrary
99105 <*> arbitrary
100106 <*> arbitrary
107+#endif
101108
102109instance PathPiece (Id t) where
103110 fromPathPiece = coerce . UUID.fromText
@@ -152,9 +159,11 @@ newtype IntId t = IntId { unIntId :: Integer }
152159#ifdef USE_STORE
153160 , Data.Store.Store
154161#endif
155− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
156− , ToParamSchema, FromHttpApiData, ToHttpApiData, PathPiece, Arbitrary
157− , Num, Integral, Real, Enum )
162+#ifdef BACKEND
163+ , ToSchema, ToParamSchema, Arbitrary
164+#endif
165+ , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, FromHttpApiData
166+ , ToHttpApiData, PathPiece, Num, Integral, Real, Enum )
158167
159168type role IntId nominal
160169
@@ -201,9 +210,11 @@ newtype Name t = Name { unName :: Text }
201210#ifdef USE_STORE
202211 , Data.Store.Store
203212#endif
204− , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, ToSchema
205− , ToParamSchema, FromHttpApiData, ToHttpApiData, PathPiece
206− , IsString, Semigroup, Monoid )
213+#ifdef BACKEND
214+ , ToSchema, ToParamSchema
215+#endif
216+ , FromJSON, ToJSON, NFData, Hashable, FromJSONKey, ToJSONKey, FromHttpApiData
217+ , ToHttpApiData, PathPiece, IsString, Semigroup, Monoid )
207218
208219type role Name nominal
209220
@@ -221,8 +232,10 @@ instance KnownSymbol s => Read (Name s) where
221232 _ <- string ("Name-" <> symbolVal (Proxy @s) <> "-")
222233 mkName <$> readS_to_P reads
223234
235+#ifdef BACKEND
224236instance Arbitrary (Name s) where
225237 arbitrary = coerce . T.pack . getPrintableString <$> arbitrary
238+#endif
226239
227240-- | This is a more \"explicit\" 'coerce' specifically for 'Name'.
228241-- You are forced to explicitly specify the phantom types you are converting