#1897: Type families: type signature rejected
----------------------+-----------------------------------------------------
 Reporter:  guest     |          Owner:     
     Type:  bug       |         Status:  new
 Priority:  normal    |      Milestone:     
Component:  Compiler  |        Version:  6.9
 Severity:  normal    |       Keywords:     
 Testcase:            |   Architecture:  x86
       Os:  Linux     |  
----------------------+-----------------------------------------------------
 The following programm does not compile:

 {{{
 {-# LANGUAGE TypeFamilies #-}

 import Control.Monad
 import Data.Maybe

 class Bug s where
   type Depend s

   next  :: s -> Depend s -> Maybe s
   start :: s

 isValid :: (Bug s) => [Depend s] -> Bool
 isValid ds = isJust $ foldM next start ds
 }}}

 Error:
 {{{
 GHCi, version 6.9.20071105: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 [1 of 1] Compiling Main             ( GHC-Bug.hs, interpreted )
 Bug.hs:13:39:
     Couldn't match expected type `Depend a'
            against inferred type `Depend s'
       Expected type: [Depend a]
       Inferred type: [Depend s]
     In the third argument of `foldM', namely `ds'
     In the second argument of `($)', namely `foldM next start ds'
 Failed, modules loaded: none.
 }}}

 When one elides the type signature the program compiles yielding the
 offending signature:
 {{{
 Prelude> :r
 [1 of 1] Compiling Main             ( GHC-Bug.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> :t isValid
 isValid :: (Bug a) => [Depend a] -> Bool
 }}}

 Compiler version: 6.9.20071105

 Best regards,
       Harald Holtmann  ([EMAIL PROTECTED])

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1897>
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