Skip to content

Commit 4772100

Browse files
Convert from NonEmpty Array to NonEmptyArray (#42)
Co-authored-by: Thomas Honeyman <[email protected]>
1 parent d63c873 commit 4772100

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test/Test/Data/Map.purs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Prelude
44

55
import Control.Alt ((<|>))
66
import Data.Array as A
7-
import Data.Array.NonEmpty as NEA
7+
import Data.Array.NonEmpty (cons')
88
import Data.Foldable (foldl, for_, all, and)
99
import Data.FoldableWithIndex (foldrWithIndex)
1010
import Data.Function (on)
@@ -14,7 +14,6 @@ import Data.List.NonEmpty as NEL
1414
import Data.Map as M
1515
import Data.Map.Gen (genMap)
1616
import Data.Maybe (Maybe(..), fromMaybe, maybe)
17-
import Data.NonEmpty ((:|))
1817
import Data.Tuple (Tuple(..), fst, uncurry)
1918
import Effect (Effect)
2019
import Effect.Console (log)
@@ -45,7 +44,7 @@ instance showSmallKey :: Show SmallKey where
4544
show J = "J"
4645

4746
instance arbSmallKey :: Arbitrary SmallKey where
48-
arbitrary = elements $ NEA.fromNonEmpty $ A :| [B, C, D, E, F, G, H, I, J]
47+
arbitrary = elements $ cons' A [B, C, D, E, F, G, H, I, J]
4948

5049
data Instruction k v = Insert k v | Delete k
5150

@@ -54,7 +53,7 @@ instance showInstruction :: (Show k, Show v) => Show (Instruction k v) where
5453
show (Delete k) = "Delete (" <> show k <> ")"
5554

5655
instance arbInstruction :: (Arbitrary k, Arbitrary v) => Arbitrary (Instruction k v) where
57-
arbitrary = oneOf $ NEA.fromNonEmpty $ (Insert <$> arbitrary <*> arbitrary) :| [Delete <$> arbitrary]
56+
arbitrary = oneOf $ cons' (Insert <$> arbitrary <*> arbitrary) [Delete <$> arbitrary]
5857

5958
runInstructions :: forall k v. Ord k => List (Instruction k v) -> M.Map k v -> M.Map k v
6059
runInstructions instrs t0 = foldl step t0 instrs

0 commit comments

Comments
 (0)