Deprecate cycle, repeat, and iterate#458
Conversation
Deprecate `Data.List.Linear.{cycle,repeat,iterate}`. Infinite results
cannot be consumed linearly, so they are not really useful in a linear
context. They could be consumed by a program that exits via an
exception, but I don't think that's something that should really be
supported.
Begins to address tweag#453
|
Alternative: just re-export the versions from |
|
Another function that looks like it has a similar issue: |
aspiwack
left a comment
There was a problem hiding this comment.
Sorry about the delay. Yes, let's deprecate, it's most certainly the right call.
Not so clear about Stream.delays though. It could conceivably be used in an infinite process (which can be cancelled with regular thread cancelling).
|
What do you mean by "regular thread cancelling"? That tends to mean death by exception, no? |
|
Indeed, this is what I have in mind. |
|
But that goes for the others too, or anything else infinite, right? |
|
Yes, you're right (also, I'm infinitely slow at responding on this thread). Somewhat I was thinking “streams have effects”, which is true, but you can also want to do These things make sense, but probably shouldn't be front and center. We could have them in a separate module. So that you will have to realise, when importing these definitions, that they're not as innocent as their equivalent in non-linear Haskell. What do you think? |
Deprecate
Data.List.Linear.{cycle,repeat,iterate}. Infinite results cannot be consumed linearly, so they are not really useful in a linear context. They could be consumed by a program that exits via an exception, but I don't think that's something that should really be supported.Begins to address #453