Opened 7 years ago

Closed 15 months ago

#1522 closed feature request (fixed)

Make [n..] etc syntax rebindable

Reported by: guest Owned by: simonpj
Priority: lowest Milestone: 7.6.2
Component: Compiler Version: 6.6.1
Keywords: Cc: ekmett@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo)

The [foo..], [foo..bar], [foo,bar..] and [foo,bar..baz] sugars do not obey -fno-implicit-prelude.

{-# OPTIONS_GHC -fno-implicit-prelude #-}
module ListSugar where

import Control.Monad
import Prelude hiding (Enum,enumFrom)

class Enum a where 
   enumFrom :: MonadPlus m => a -> m a
instance Enum Int where 
   enumFrom n = return n `mplus` enumFrom (n + 1)

main = print $ ([1..] :: Maybe Int)

ListSugar.hs:9:16:
    Couldn't match expected type `Maybe Int'
           against inferred type `[a]'
    In the expression: [1 .. ]
    In the second argument of `($)', namely `([1 .. ] :: Maybe Int)'
    In the expression: print $ ([1 .. ] :: Maybe Int)

and even with the same signature as the original type, it invokes the version in the Prelude.

Attachments (1)

ListSugar.hs (288 bytes) - added by guest 7 years ago.
example

Download all attachments as: .zip

Change History (17)

Changed 7 years ago by guest

example

comment:1 Changed 7 years ago by guest

  • Cc ekmett@… added

comment:2 Changed 7 years ago by igloo

  • Description modified (diff)

comment:3 Changed 7 years ago by igloo

  • Milestone set to 6.1
  • Summary changed from enumFrom* do not respect -fno-implicit-prelude to Make [n..] etc syntax rebindable

comment:4 Changed 7 years ago by simonpj

  • Owner set to simonpj
  • Type changed from bug to feature request

The manual does not claim that this works. It's a perfectly reasonable feature request though.

Simon

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Multiple to Unknown/Multiple

comment:6 Changed 6 years ago by simonmar

  • Operating System changed from Multiple to Unknown/Multiple

comment:7 Changed 5 years ago by igloo

  • Milestone changed from 6.10 branch to 6.12 branch

comment:8 Changed 4 years ago by igloo

  • Milestone changed from 6.12 branch to 6.12.3

comment:9 Changed 4 years ago by igloo

  • Milestone changed from 6.12.3 to 6.14.1
  • Priority changed from normal to low

comment:10 Changed 3 years ago by igloo

  • Milestone changed from 7.0.1 to 7.0.2

comment:11 Changed 3 years ago by igloo

  • Milestone changed from 7.0.2 to 7.2.1

comment:12 Changed 3 years ago by igloo

  • Milestone changed from 7.2.1 to 7.4.1

comment:13 Changed 2 years ago by igloo

  • Milestone changed from 7.4.1 to 7.6.1
  • Priority changed from low to lowest

comment:14 Changed 19 months ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:15 Changed 15 months ago by morabbin

  • Type of failure set to None/Unknown

This is somewhat handled by GHC extension OverloadedLists.

comment:16 Changed 15 months ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

Yes, it is. So I'll close this ticket. Hurrah.

Note: See TracTickets for help on using tickets.