#5771: Confusing printout with PolyKinds
---------------------------------+------------------------------------------
    Reporter:  goldfire          |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  7.4.1-rc1       
    Keywords:  PolyKinds         |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  Other           
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by anders_):

 * cc: andy@… (added)


Comment:

 Also, the kind parameter for a type counts as a parameter for whether a
 class
 involving that type needs MultiParamTypeClasses or not. Unless it’s *,
 strangely.

 That wasn’t a very clear explanation, so here’s an example. Involving a
 variant
 monad class *and* HList, naturally. :)

 {{{

 > {-# LANGUAGE DataKinds, PolyKinds, GADTs, TypeOperators #-}
 > {-    # LANGUAGE MultiParamTypeClasses #-}
 >
 > class IndexedMonad m where
 >   unit :: a -> m i i a
 >   bind :: m i j a -> (a -> m j k b) -> m i k b
 >
 > newtype IndexedIO i j a = IndexedIO {runIndexedIO :: IO a}
 >
 > -- i and j are both *; instance is accepted
 > instance IndexedMonad IndexedIO where
 >   unit = IndexedIO . return
 >   bind m k = IndexedIO $ runIndexedIO m >>= runIndexedIO . k
 > infixl 1 `bind`
 >
 > data HList xs where
 >   N    :: HList '[]
 >   (:>) :: a -> HList as -> HList (a ': as)
 > infixr 5 :>
 >
 > newtype HLState xs ys a = HLState {runHLState :: HList xs -> (a, HList
 ys)}
 >
 > -- i and j are now [*]; rejected with the MPTCs message
 > instance IndexedMonad HLState where
 >   unit x = HLState $ \s -> (x, s)
 >   bind (HLState f) k = HLState $ \xs ->
 >     case f xs of (a, ys) -> runHLState (k a) ys

 }}}

 (I ''think'' this is another manifestation of the same bug; if not, I can
 submit a new ticket.)

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