@@ -257,13 +257,14 @@ toString (UUID tl tm th ch cl n) = printf "%08x-%04x-%04x-%02x%02x-%s" tl tm th
259-- remove all occurances of the input element in the inpt list.
259-- remove all occurances of the input element in the inpt list.
260−-- non of the sub-lists are empty.
260+-- none of the sub-lists are empty.
261splitList :: Eq a => a -> [a] -> [[a]]
261splitList :: Eq a => a -> [a] -> [[a]]
262splitList c xs = let ys = dropWhile (== c) xs
262splitList c xs = let ys = dropWhile (== c) xs
263 in case span (/= c) ys of
263 in case span (/= c) ys of
264 ([],_) -> []
264 ([],_) -> []
265 (sub,rest) -> sub : splitList c rest
265 (sub,rest) -> sub : splitList c rest
267+-- the passed-in predicate signals when to stop unfolding
267unfoldUntil :: (b -> Bool) -> (b -> (a, b)) -> b -> [a]
268unfoldUntil :: (b -> Bool) -> (b -> (a, b)) -> b -> [a]
268unfoldUntil p f n = unfoldr g n
269unfoldUntil p f n = unfoldr g n
269 where g m | p m = Nothing
270 where g m | p m = Nothing
@@ -274,10 +275,11 @@ unfoldUntil p f n = unfoldr g n
274-- this will work, though
275-- this will work, though
276randomBoundedIntegral :: (RandomGen g, Bounded a, Integral a) => g -> (a, g)
277randomBoundedIntegral :: (RandomGen g, Bounded a, Integral a) => g -> (a, g)
278+randomBoundedIntegral g =
277−randomBoundedIntegral g = let (n, g1) = randomR (fromIntegral l, fromIntegral u) g
279+ let (n, g1) = randomR (fromIntegral l, fromIntegral u) g
278− _ = n :: Integer
280+ _ = n :: Integer
279− retVal = fromIntegral n `asTypeOf` (l `asTypeOf` u)
281+ retVal = fromIntegral n `asTypeOf` (l `asTypeOf` u)
280− u = maxBound
282+ u = maxBound
281− l = minBound
283+ l = minBound
282− in (retVal, g1)
284+ in (retVal, g1)