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)beforeenumFromTobecomeseftInt. This does not, unfortunately, seem to work. - Grab
eftIntafter it gets written back fromeftIntFB. This would probably work, but it's currently impossible becauseeftIntis not exported fromGHC.Extsor evenGHC.Enum. - Add
enumFromTo, etc., to theIsListclass. Default to the current behavior, but if possible usefromListNfor well-knownEnumtypes.
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 |