@@ -257,13 +257,14 @@ toString (UUID tl tm th ch cl n) = printf "%08x-%04x-%04x-%02x%02x-%s" tl tm th
257257
258258
259259-- 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.
261261splitList :: Eq a => a -> [a] -> [[a]]
262262splitList c xs = let ys = dropWhile (== c) xs
263263 in case span (/= c) ys of
264264 ([],_) -> []
265265 (sub,rest) -> sub : splitList c rest
266266
267+-- the passed-in predicate signals when to stop unfolding
267268unfoldUntil :: (b -> Bool) -> (b -> (a, b)) -> b -> [a]
268269unfoldUntil p f n = unfoldr g n
269270 where g m | p m = Nothing
@@ -274,10 +275,11 @@ unfoldUntil p f n = unfoldr g n
274275-- this will work, though
275276
276277randomBoundedIntegral :: (RandomGen g, Bounded a, Integral a) => g -> (a, g)
277−randomBoundedIntegral g = let (n, g1) = randomR (fromIntegral l, fromIntegral u) g
278− _ = n :: Integer
279− retVal = fromIntegral n `asTypeOf` (l `asTypeOf` u)
280− u = maxBound
281− l = minBound
282− in (retVal, g1)
278+randomBoundedIntegral g =
279+ let (n, g1) = randomR (fromIntegral l, fromIntegral u) g
280+ _ = n :: Integer
281+ retVal = fromIntegral n `asTypeOf` (l `asTypeOf` u)
282+ u = maxBound
283+ l = minBound
284+ in (retVal, g1)
283285