To my big surprise, the cycle function from base is partial: it fails on empty lists
ghci> :t cycle
cycle :: [a] -> [a]
ghci> cycle []
*** Exception: Prelude.cycle: empty list
It's a bit problematic, since we don't want to expose partial functions. I see the following options:
- Don't reexport
cycle.
- Change its type to
NonEmpty a -> NonEmpty a.
- Reimplement manually by returning empty list when empty list is given.
@vrom911, what do you think?
To my big surprise, the
cyclefunction frombaseis partial: it fails on empty listsIt's a bit problematic, since we don't want to expose partial functions. I see the following options:
cycle.NonEmpty a -> NonEmpty a.@vrom911, what do you think?