Skip to content

Commit 9eef016

Browse files
authored
Merge pull request #116 from purescript/no-monomorphic-proxies
Replace monomorphic proxies by Type.Proxy.Proxy and polymorphic variables
2 parents 7c5943a + 7a943a7 commit 9eef016

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/Test/QuickCheck/Arbitrary.purs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ import Data.String.CodeUnits (charAt, fromCharArray)
3636
import Data.String.NonEmpty (NonEmptyString)
3737
import Data.String.NonEmpty as NES
3838
import Data.String.NonEmpty.CodeUnits as NESCU
39-
import Data.Symbol (class IsSymbol, SProxy(..))
39+
import Data.Symbol (class IsSymbol)
4040
import Data.Tuple (Tuple(..))
4141
import Partial.Unsafe (unsafePartial)
4242
import Prim.Row as Row
4343
import Prim.RowList as RL
4444
import Record as Record
4545
import Test.QuickCheck.Gen (Gen, arrayOf, chooseInt, elements, listOf, oneOf, perturbGen, repeatable, sized, uniform)
46-
import Type.Data.RowList (RLProxy(..))
46+
import Type.Proxy (Proxy(..))
4747

4848
-- | The `Arbitrary` class represents those types whose values can be
4949
-- | _randomly-generated_.
@@ -244,8 +244,9 @@ genericCoarbitrary :: forall a rep. Generic a rep => Coarbitrary rep => a -> Gen
244244
genericCoarbitrary x g = to <$> coarbitrary (from x) (from <$> g)
245245

246246
-- | A helper typeclass to implement `Arbitrary` for records.
247+
class ArbitraryRowList :: RL.RowList Type -> Row Type -> Constraint
247248
class ArbitraryRowList list row | list -> row where
248-
arbitraryRecord :: RLProxy list -> Gen (Record row)
249+
arbitraryRecord :: forall rlproxy. rlproxy list -> Gen (Record row)
249250

250251
instance arbitraryRowListNil :: ArbitraryRowList RL.Nil () where
251252
arbitraryRecord _ = pure {}
@@ -260,11 +261,11 @@ instance arbitraryRowListCons ::
260261
) => ArbitraryRowList (RL.Cons key a listRest) rowFull where
261262
arbitraryRecord _ = do
262263
value <- arbitrary
263-
previous <- arbitraryRecord (RLProxy :: RLProxy listRest)
264-
pure $ Record.insert (SProxy :: SProxy key) value previous
264+
previous <- arbitraryRecord (Proxy :: Proxy listRest)
265+
pure $ Record.insert (Proxy :: Proxy key) value previous
265266

266267
instance arbitraryRecordInstance ::
267268
( RL.RowToList row list
268269
, ArbitraryRowList list row
269270
) => Arbitrary (Record row) where
270-
arbitrary = arbitraryRecord (RLProxy :: RLProxy list)
271+
arbitrary = arbitraryRecord (Proxy :: Proxy list)

0 commit comments

Comments
 (0)