Skip to content

Commit 1f87eb3

Browse files
committed
Update for changes in strings
1 parent f891921 commit 1f87eb3

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/Test/QuickCheck/Arbitrary.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import Control.Monad.ST as ST
1919
import Data.Array.NonEmpty (NonEmptyArray)
2020
import Data.Array.NonEmpty as NEA
2121
import Data.Array.ST as STA
22-
import Data.Char (toCharCode, fromCharCode)
2322
import Data.Either (Either(..))
23+
import Data.Enum (fromEnum, toEnumWithDefaults)
2424
import Data.Foldable (foldl)
2525
import Data.Generic.Rep (class Generic, to, from, NoArguments(..), Sum(..), Product(..), Constructor(..), Argument(..))
2626
import Data.Identity (Identity(..))
@@ -31,15 +31,15 @@ import Data.List.NonEmpty (NonEmptyList(..))
3131
import Data.Maybe (Maybe(..), fromJust)
3232
import Data.Newtype (wrap)
3333
import Data.NonEmpty (NonEmpty(..), (:|))
34-
import Record as Record
35-
import Data.String (charCodeAt, fromCharArray, split)
34+
import Data.String.CodeUnits (charAt, fromCharArray, split)
3635
import Data.String.NonEmpty (NonEmptyString)
37-
import Data.String.NonEmpty as NES
36+
import Data.String.NonEmpty.CodeUnits as NES
3837
import Data.Symbol (class IsSymbol, SProxy(..))
3938
import Data.Tuple (Tuple(..))
4039
import Partial.Unsafe (unsafePartial)
4140
import Prim.Row as Row
4241
import Prim.RowList as RL
42+
import Record as Record
4343
import Test.QuickCheck.Gen (Gen, arrayOf, chooseInt, elements, listOf, oneOf, perturbGen, repeatable, sized, uniform)
4444
import Type.Data.RowList (RLProxy(..))
4545

@@ -86,7 +86,7 @@ instance arbString :: Arbitrary String where
8686
arbitrary = fromCharArray <$> arbitrary
8787

8888
instance coarbString :: Coarbitrary String where
89-
coarbitrary s = coarbitrary $ (charCodeAt zero <$> split (wrap "") s)
89+
coarbitrary s = coarbitrary $ (charAt zero <$> split (wrap "") s)
9090

9191
instance arbNonEmptyString :: Arbitrary NonEmptyString where
9292
arbitrary = NES.cons <$> arbitrary <*> arbitrary
@@ -95,10 +95,10 @@ instance coarbNonEmptyString :: Coarbitrary NonEmptyString where
9595
coarbitrary = coarbitrary <<< NES.toString
9696

9797
instance arbChar :: Arbitrary Char where
98-
arbitrary = fromCharCode <$> chooseInt 0 65536
98+
arbitrary = toEnumWithDefaults bottom top <$> chooseInt 0 65536
9999

100100
instance coarbChar :: Coarbitrary Char where
101-
coarbitrary c = coarbitrary $ toCharCode c
101+
coarbitrary c = coarbitrary $ fromEnum c
102102

103103
instance arbUnit :: Arbitrary Unit where
104104
arbitrary = pure unit

0 commit comments

Comments
 (0)