(op `on` f) x y = f x `op` f y
>>> sortBy (compare `on` length) [[0, 1, 2], [0, 1], [], [0]] [[],[0],[0,1],[0,1,2]]
>>> ((+) `on` length) [1, 2, 3] [-1] 4
>>> ((,) `on` (*2)) 2 3 (4,6)
partition p bs == (filter p xs, filter (not . p) xs)
let xs = cons' c xs in xsYou can however use cons, as well as repeat and cycle, to build infinite lazy ByteStrings.