@@ -4,7 +4,7 @@ import Prelude
4
4
5
5
import Control.Alt ((<|>))
6
6
import Data.Array as A
7
- import Data.Array.NonEmpty as NEA
7
+ import Data.Array.NonEmpty ( cons' )
8
8
import Data.Foldable (foldl , for_ , all , and )
9
9
import Data.FoldableWithIndex (foldrWithIndex )
10
10
import Data.Function (on )
@@ -14,7 +14,6 @@ import Data.List.NonEmpty as NEL
14
14
import Data.Map as M
15
15
import Data.Map.Gen (genMap )
16
16
import Data.Maybe (Maybe (..), fromMaybe , maybe )
17
- import Data.NonEmpty ((:|))
18
17
import Data.Tuple (Tuple (..), fst , uncurry )
19
18
import Effect (Effect )
20
19
import Effect.Console (log )
@@ -45,7 +44,7 @@ instance showSmallKey :: Show SmallKey where
45
44
show J = " J"
46
45
47
46
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 ]
49
48
50
49
data Instruction k v = Insert k v | Delete k
51
50
@@ -54,7 +53,7 @@ instance showInstruction :: (Show k, Show v) => Show (Instruction k v) where
54
53
show (Delete k) = " Delete (" <> show k <> " )"
55
54
56
55
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]
58
57
59
58
runInstructions :: forall k v . Ord k => List (Instruction k v ) -> M.Map k v -> M.Map k v
60
59
runInstructions instrs t0 = foldl step t0 instrs
0 commit comments