@@ -14,11 +14,12 @@ import Data.Identity (Identity(..))
14
14
import Data.Int (toNumber )
15
15
import Data.Lazy (Lazy , defer , force )
16
16
import Data.List (List )
17
+ import Data.List.NonEmpty (NonEmptyList (..))
17
18
import Data.Maybe (Maybe (..))
18
19
import Data.Newtype (wrap )
20
+ import Data.NonEmpty (NonEmpty (..), (:|))
19
21
import Data.String (charCodeAt , fromCharArray , split )
20
22
import Data.Tuple (Tuple (..))
21
- import Data.NonEmpty ((:|))
22
23
23
24
import Test.QuickCheck.Gen (Gen , listOf , chooseInt , sized , perturbGen , repeatable , arrayOf , oneOf , uniform )
24
25
@@ -144,3 +145,15 @@ instance arbitraryLazy :: Arbitrary a => Arbitrary (Lazy a) where
144
145
145
146
instance coarbLazy :: Coarbitrary a => Coarbitrary (Lazy a ) where
146
147
coarbitrary a = coarbitrary (force a)
148
+
149
+ instance arbNonEmpty :: (Arbitrary (f a ), Arbitrary a ) => Arbitrary (NonEmpty f a ) where
150
+ arbitrary = NonEmpty <$> arbitrary <*> arbitrary
151
+
152
+ instance coarbNonEmpty :: (Coarbitrary (f a ), Coarbitrary a ) => Coarbitrary (NonEmpty f a ) where
153
+ coarbitrary (NonEmpty head tail) = coarbitrary head >>> coarbitrary tail
154
+
155
+ instance arbNonEmptyList :: Arbitrary a => Arbitrary (NonEmptyList a ) where
156
+ arbitrary = NonEmptyList <$> arbitrary
157
+
158
+ instance coarbNonEmptyList :: Coarbitrary a => Coarbitrary (NonEmptyList a ) where
159
+ coarbitrary (NonEmptyList nel) = coarbitrary nel
0 commit comments