Improve enumFromX support for OverloadedLists
At present, OverloadedLists
desugars [m..n]
as fromList (enumFromTo m n)
. This is sometimes okay, but terrible for Data.Sequence
. In particular, I want, for example,
[m..n] :: Seq Int
to end up as fromFunction (n-m+1) (+m)
, which performs much better. There are a few approaches that look reasonable:
- Try to catch
fromList (enumFromTo m n)
beforeenumFromTo
becomeseftInt
. This does not, unfortunately, seem to work. - Grab
eftInt
after it gets written back fromeftIntFB
. This would probably work, but it's currently impossible becauseeftInt
is not exported fromGHC.Exts
or evenGHC.Enum
. - Add
enumFromTo
, etc., to theIsList
class. Default to the current behavior, but if possible usefromListN
for well-knownEnum
types.
Trac metadata
Trac field | Value |
---|---|
Version | 7.9 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Core Libraries |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | core-libraries-committee@haskell.org |
Operating system | |
Architecture |