File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
containers-tests/tests/Utils Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ module Utils.ArbitrarySetMap
1515import Control.Monad (liftM , liftM3 , liftM4 )
1616import Control.Monad.Trans.State.Strict
1717import Control.Monad.Trans.Class
18+ import qualified Data.List as List
19+ import Data.Maybe (fromMaybe )
1820import Test.QuickCheck
1921
2022import Data.Set (Set )
@@ -68,13 +70,7 @@ mkArbSet step n
6870setFromList :: [a ] -> Gen (Set a )
6971setFromList xs = flip evalStateT xs $ mkArbSet step (length xs)
7072 where
71- step = do
72- xxs <- get
73- case xxs of
74- x : xs -> do
75- put xs
76- pure x
77- [] -> error " setFromList"
73+ step = state $ fromMaybe (error " setFromList" ) . List. uncons
7874
7975{- -------------------------------------------------------------------
8076 Map
@@ -117,11 +113,5 @@ mkArbMap step n
117113mapFromKeysList :: Arbitrary a => [k ] -> Gen (Map k a )
118114mapFromKeysList xs = flip evalStateT xs $ mkArbMap step (length xs)
119115 where
120- step = do
121- xxs <- get
122- case xxs of
123- x : xs -> do
124- put xs
125- pure x
126- [] -> error " mapFromKeysList"
116+ step = state $ fromMaybe (error " mapFromKeysList" ) . List. uncons
127117{-# INLINABLE mapFromKeysList #-}
You can’t perform that action at this time.
0 commit comments