#1522: enumFrom* do not respect -fno-implicit-prelude
-----------------------+----------------------------------------------------
  Reporter:  guest     |          Owner:          
      Type:  bug       |         Status:  new     
  Priority:  normal    |      Milestone:          
 Component:  Compiler  |        Version:  6.6.1   
  Severity:  normal    |       Keywords:          
Difficulty:  Unknown   |             Os:  Multiple
  Testcase:            |   Architecture:  Multiple
-----------------------+----------------------------------------------------
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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1522>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to