Skip to content

Commit 6bae4fc

Browse files
committed
AlphaNumString instances
1 parent 5640b07 commit 6bae4fc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Test/QuickCheck/Data/AlphaNumString.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import Data.Newtype (class Newtype)
88
import Data.String (fromCharArray, toCharArray)
99

1010
import Test.QuickCheck.Gen (Gen, arrayOf, oneOf)
11-
import Test.QuickCheck.Arbitrary (class Coarbitrary, class Arbitrary, coarbitrary)
11+
import Test.QuickCheck.Arbitrary (class Coarbitrary, class Arbitrary)
1212

1313
-- | A newtype for `String` whose `Arbitrary` instance generated random
1414
-- | alphanumeric strings.
1515
newtype AlphaNumString = AlphaNumString String
1616

1717
derive instance newtypeAlphaNumString :: Newtype AlphaNumString _
18+
derive newtype instance eqAlphaNumString :: Eq AlphaNumString
19+
derive newtype instance ordAlphaNumString :: Ord AlphaNumString
1820

1921
instance arbAlphaNumString :: Arbitrary AlphaNumString where
2022
arbitrary = AlphaNumString <<< fromCharArray <$> arrayOf anyChar
@@ -25,5 +27,4 @@ instance arbAlphaNumString :: Arbitrary AlphaNumString where
2527
anyChar :: Gen Char
2628
anyChar = oneOf (pure 'a') (map pure rest)
2729

28-
instance coarbAlphaNumString :: Coarbitrary AlphaNumString where
29-
coarbitrary (AlphaNumString s) = coarbitrary s
30+
derive newtype instance coarbAlphaNumString :: Coarbitrary AlphaNumString

0 commit comments

Comments
 (0)