#1123: Impredicativity bug: forall not hoisted properly
--------------------------------------------------+-------------------------
 Reporter:  Ashley Yakeley <[EMAIL PROTECTED]>  |          Owner:  simonpj    
     Type:  bug                                   |         Status:  new        
 Priority:  normal                                |      Milestone:  6.10 branch
Component:  Compiler                              |        Version:  6.6        
 Severity:  normal                                |     Resolution:             
 Keywords:                                        |     Difficulty:  Unknown    
 Testcase:                                        |   Architecture:  Unknown    
       Os:  Unknown                               |  
--------------------------------------------------+-------------------------
Comment (by guest):

 the runA2 case was a simplification of the following code:
 {{{
 newtype M s a = M (StateT (UnionFind (RevertArray s) (STRef s) (ST s))
 (ChoiceT (ST s)) a)
   deriving (Monad, MonadPlus)

 runM :: Int -> (forall s. M s b) -> [b]
 runM n (M m) = runST (do uf <- newUnionFind n
                          findAll $ fmap fst $ runStateT uf m)

 -- The following declarations are included to explain the types of the
 functions in scope

 newUnionFind :: PersistentArray a => Int -> ST s (UnionFind a s)
 newUnionFind = undefined

 findAll :: Monad m => ChoiceT m a -> m [a]
 findAll = undefined

 runStateT :: i -> StateT i m a -> m (a, i)
 runStateT = undefined
 }}}

 My solution was to write an un-newtyping function ( M s a -> StateT
 (UnionFind (RevertArray s) (STRef s) (ST s)) (ChoiceT (ST s)) a ) and call
 that inside the "runST" but it wasn't clear why I would be required to do
 so.

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