>>> Stream.parse ((,) <$> Parser.satisfy (> 0) <*> Parser.eof) $ Stream.fromList [1] Right (1,())
>>> createOf = MutArray.createOfWith MutArray.new >>> createOf n = Fold.take n (MutArray.unsafeCreateOf n) >>> createOf n = MutArray.appendN n (MutArray.emptyOf n)
>>> createOf n = Fold.take n (MutArray.unsafeCreateOf n)Pre-release
>>> noneOf xs = Parser.satisfy (`Foldable.notElem` xs)
>>> oneOf xs = Parser.satisfy (`Foldable.elem` xs)When performance matters a pattern matching predicate could be more efficient than a Foldable datatype:
let p x = case x of a -> True e -> True _ -> False in satisfy pGHC may use a binary search instead of linear search in the list. Alternatively, you can also use an array instead of list for storage and search.
>>> Stream.isSubsequenceOf (Stream.fromList "hlo") (Stream.fromList "hello" :: Stream IO Char) True
>>> createOfWith alloc n = Fold.take n (MutArray.unsafeCreateOfWith alloc n) >>> createOfWith alloc n = MutArray.appendN (alloc n) n
>>> unsafeCreateOf = MutArray.unsafeCreateOfWith MutArray.emptyOf
>>> unsafeCreateOfWith alloc n = MutArray.unsafeAppendN (alloc n) nPre-release