[GHC] #8382: ghc unhappy with program who want to program in C in haskell...

GHC ghc-devs at haskell.org
Sun Sep 29 13:00:21 CEST 2013


#8382: ghc unhappy with program who want to program in C in haskell...
-------------------------------------+------------------------------------
        Reporter:  wagle             |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.6.3
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by wagle):

 -dcore-lint gives:

 tuple:p3 wagle$ ghc -dcore-lint test1.hs
 [1 of 1] Compiling Main             ( test1.hs, test1.o )
 *** Core Lint errors : in result of Desugar (after optimization) ***
 <no location info>: Warning:
     In the expression: GHC.Show.$fShow[]
                          @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *))
                          $dShow_aLp
     $dShow_aLp
       :: GHC.Show.Show
            (Data.Vector.Mutable.MVector GHC.Prim.RealWorld a_t1z)
     [LclId] is out of scope
 <no location info>: Warning:
     In the expression: GHC.Show.$fShow[]
                          @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *))
                          $dShow_aLp
     Argument value doesn't match argument type:
     Fun type:
         GHC.Show.Show
           (Data.Vector.Mutable.MVector
              GHC.Prim.RealWorld (GHC.Prim.Any *)) =>
         GHC.Show.Show
           [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any
 *)]
     Arg type:
         GHC.Show.Show
           (Data.Vector.Mutable.MVector GHC.Prim.RealWorld a_t1z)
     Arg: $dShow_aLp
 *** Offending Program ***
 Rec {
 Main.updateMatrix
   :: forall (m_azy :: * -> *) a_azz.
      Control.Monad.Primitive.PrimMonad m_azy =>
      Data.Vector.Mutable.MVector
        (Control.Monad.Primitive.PrimState m_azy)
        (Data.Vector.Mutable.MVector
           (Control.Monad.Primitive.PrimState m_azy) a_azz)
      -> (GHC.Types.Int, GHC.Types.Int) -> a_azz -> m_azy ()
 [LclId]
 Main.updateMatrix =
   \ (@ (m_azC :: * -> *))
     (@ a_azD)
     ($dPrimMonad_azE :: Control.Monad.Primitive.PrimMonad m_azC) ->
     let {
       $dMonad_ayF :: GHC.Base.Monad m_azC
       [LclId]
       $dMonad_ayF =
         Control.Monad.Primitive.$p1PrimMonad @ m_azC $dPrimMonad_azE } in
     \ (m_ays
          :: Data.Vector.Mutable.MVector
               (Control.Monad.Primitive.PrimState m_azC)
               (Data.Vector.Mutable.MVector
                  (Control.Monad.Primitive.PrimState m_azC) a_azD))
       (ds_dM4 :: (GHC.Types.Int, GHC.Types.Int))
       (x_ayv :: a_azD) ->
       case ds_dM4 of _ { (i_ayt, j_ayu) ->
       GHC.Base.>>=
         @ m_azC
         $dMonad_ayF
         @ (Data.Vector.Mutable.MVector
              (Control.Monad.Primitive.PrimState m_azC) a_azD)
         @ ()
         (Data.Vector.Mutable.read
            @ m_azC
            @ (Data.Vector.Mutable.MVector
                 (Control.Monad.Primitive.PrimState m_azC) a_azD)
            $dPrimMonad_azE
            m_ays
            i_ayt)
         (\ (v_ayw
               :: Data.Vector.Mutable.MVector
                    (Control.Monad.Primitive.PrimState m_azC) a_azD) ->
            Data.Vector.Mutable.write
              @ m_azC @ a_azD $dPrimMonad_azE v_ayw j_ayu x_ayv)
       }

 Main.createMatrix
   :: forall (m_aEn :: * -> *) a_aEo.
      (GHC.Num.Num a_aEo, Control.Monad.Primitive.PrimMonad m_aEn) =>
      (GHC.Types.Int, GHC.Types.Int)
      -> m_aEn (Data.Vector.Mutable.MVector
                  (Control.Monad.Primitive.PrimState m_aEn)
                  (Data.Vector.Mutable.MVector
                     (Control.Monad.Primitive.PrimState m_aEn) a_aEo))
 [LclId]
 Main.createMatrix =
   \ (@ (m_aEs :: * -> *))
     (@ a_aEt)
     ($dNum_aEu :: GHC.Num.Num a_aEt)
     ($dPrimMonad_aEv :: Control.Monad.Primitive.PrimMonad m_aEs) ->
     let {
       $dMonad_azP :: GHC.Base.Monad m_aEs
       [LclId]
       $dMonad_azP =
         Control.Monad.Primitive.$p1PrimMonad @ m_aEs $dPrimMonad_aEv } in
     \ (ds_dMj :: (GHC.Types.Int, GHC.Types.Int)) ->
       case ds_dMj of _ { (vsize_ay5, ksize_ay6) ->
       GHC.Base.>>=
         @ m_aEs
         $dMonad_azP
         @ (Data.Vector.Mutable.MVector
              (Control.Monad.Primitive.PrimState m_aEs)
              (Data.Vector.Mutable.MVector
                 (Control.Monad.Primitive.PrimState m_aEs) a_aEt))
         @ (Data.Vector.Mutable.MVector
              (Control.Monad.Primitive.PrimState m_aEs)
              (Data.Vector.Mutable.MVector
                 (Control.Monad.Primitive.PrimState m_aEs) a_aEt))
         (Data.Vector.Mutable.new
            @ m_aEs
            @ (Data.Vector.Mutable.MVector
                 (Control.Monad.Primitive.PrimState m_aEs) a_aEt)
            $dPrimMonad_aEv
            vsize_ay5)
         (\ (m_ay7
               :: Data.Vector.Mutable.MVector
                    (Control.Monad.Primitive.PrimState m_aEs)
                    (Data.Vector.Mutable.MVector
                       (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) ->
            GHC.Base.>>
              @ m_aEs
              $dMonad_azP
              @ ()
              @ (Data.Vector.Mutable.MVector
                   (Control.Monad.Primitive.PrimState m_aEs)
                   (Data.Vector.Mutable.MVector
                      (Control.Monad.Primitive.PrimState m_aEs) a_aEt))
              (GHC.Base.$
                 @ (GHC.Types.Int -> m_aEs ())
                 @ (m_aEs ())
                 (Control.Monad.forM_
                    @ GHC.Types.Int
                    @ m_aEs
                    @ ()
                    $dMonad_azP
                    (GHC.Enum.enumFromTo
                       @ GHC.Types.Int
                       GHC.Enum.$fEnumInt
                       (GHC.Types.I# 0)
                       (GHC.Num.-
                          @ GHC.Types.Int GHC.Num.$fNumInt vsize_ay5
 (GHC.Types.I# 1))))
                 (\ (i_ayq :: GHC.Types.Int) ->
                    GHC.Base.>>=
                      @ m_aEs
                      $dMonad_azP
                      @ (Data.Vector.Mutable.MVector
                           (Control.Monad.Primitive.PrimState m_aEs) a_aEt)
                      @ ()
                      (Data.Vector.Mutable.new @ m_aEs @ a_aEt
 $dPrimMonad_aEv ksize_ay6)
                      (\ (v_ayr
                            :: Data.Vector.Mutable.MVector
                                 (Control.Monad.Primitive.PrimState m_aEs)
 a_aEt) ->
                         GHC.Base.>>
                           @ m_aEs
                           $dMonad_azP
                           @ ()
                           @ ()
                           (Data.Vector.Mutable.set
                              @ m_aEs
                              @ a_aEt
                              $dPrimMonad_aEv
                              v_ayr
                              (GHC.Num.fromInteger @ a_aEt $dNum_aEu
 (__integer 0)))
                           (Data.Vector.Mutable.write
                              @ m_aEs
                              @ (Data.Vector.Mutable.MVector
                                   (Control.Monad.Primitive.PrimState
 m_aEs) a_aEt)
                              $dPrimMonad_aEv
                              m_ay7
                              i_ayq
                              v_ayr))))
              (GHC.Base.return
                 @ m_aEs
                 $dMonad_azP
                 @ (Data.Vector.Mutable.MVector
                      (Control.Monad.Primitive.PrimState m_aEs)
                      (Data.Vector.Mutable.MVector
                         (Control.Monad.Primitive.PrimState m_aEs) a_aEt))
                 m_ay7))
       }

 $dShow_aJR
   :: GHC.Show.Show
        [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)]
 [LclId]
 $dShow_aJR =
   GHC.Show.$fShow[]
     @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))
     $dShow_aLp

 cobox_aFM
   :: Data.Vector.Vector
        (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))
      ~ Data.Vector.Generic.Base.Mutable
          (GHC.Prim.Any (* -> *))
          (Control.Monad.Primitive.PrimState GHC.Types.IO)
          (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))
 [LclId]
 cobox_aFM =
   case cobox_aKH of _ { GHC.Types.Eq# cobox_dMX ->
   GHC.Types.Eq#
     @ *
     @ (Data.Vector.Vector
          (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any
 *)))
     @ (Data.Vector.Generic.Base.Mutable
          v_t1O
          (Control.Monad.Primitive.PrimState GHC.Types.IO)
          (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any
 *)))
     @~ (cobox_dMX <Data.Vector.Mutable.MVector
                      GHC.Prim.RealWorld (GHC.Prim.Any *)>)
   }

 Main.main :: GHC.Types.IO ()
 [LclIdX]
 Main.main =
   GHC.Base.>>=
     @ GHC.Types.IO
     GHC.Base.$fMonadIO
     @ (Data.Vector.Vector
          (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any
 *)))
     @ ()
     (((\ (@ (m_aFh :: * -> *))
          (@ a_aFi)
          ($dNum_aFj :: GHC.Num.Num a_aFi)
          ($dPrimMonad_aFk :: Control.Monad.Primitive.PrimMonad m_aFh) ->
          let {
            $dMonad_aEI :: GHC.Base.Monad m_aFh
            [LclId]
            $dMonad_aEI =
              Control.Monad.Primitive.$p1PrimMonad @ m_aFh $dPrimMonad_aFk
 } in
          \ (vsize_ay2 :: GHC.Types.Int) (ksize_ay3 :: GHC.Types.Int) ->
            GHC.Base.>>=
              @ m_aFh
              $dMonad_aEI
              @ (Data.Vector.Mutable.MVector
                   (Control.Monad.Primitive.PrimState m_aFh)
                   (Data.Vector.Mutable.MVector
                      (Control.Monad.Primitive.PrimState m_aFh) a_aFi))
              @ (Data.Vector.Vector
                   (Data.Vector.Mutable.MVector
                      (Control.Monad.Primitive.PrimState m_aFh) a_aFi))
              (Main.createMatrix
                 @ m_aFh @ a_aFi $dNum_aFj $dPrimMonad_aFk (vsize_ay2,
 ksize_ay3))
              (\ (matrix_ay4
                    :: Data.Vector.Mutable.MVector
                         (Control.Monad.Primitive.PrimState m_aFh)
                         (Data.Vector.Mutable.MVector
                            (Control.Monad.Primitive.PrimState m_aFh)
 a_aFi)) ->
                 GHC.Base.>>
                   @ m_aFh
                   $dMonad_aEI
                   @ ()
                   @ (Data.Vector.Vector
                        (Data.Vector.Mutable.MVector
                           (Control.Monad.Primitive.PrimState m_aFh)
 a_aFi))
                   (Main.updateMatrix
                      @ m_aFh
                      @ a_aFi
                      $dPrimMonad_aFk
                      matrix_ay4
                      (GHC.Types.I# 1, GHC.Types.I# 1)
                      (GHC.Num.fromInteger @ a_aFi $dNum_aFj (__integer
 2)))
                   (Data.Vector.unsafeFreeze
                      @ m_aFh
                      @ (Data.Vector.Mutable.MVector
                           (Control.Monad.Primitive.PrimState m_aFh) a_aFi)
                      $dPrimMonad_aFk
                      matrix_ay4)))
         @ GHC.Types.IO
         @ (GHC.Prim.Any *)
         $dNum_aFz
         Control.Monad.Primitive.$fPrimMonadIO
         (GHC.Types.I# 3)
         (GHC.Types.I# 3))
      `cast` (GHC.Types.IO
                (Data.Vector.Vector
                   (Data.Vector.Mutable.MVector
                      <(Control.Monad.Primitive.TFCo:R:PrimStateIO)>
 <GHC.Prim.Any *>))
              :: GHC.Types.IO
                   (Data.Vector.Vector
                      (Data.Vector.Mutable.MVector
                         (Control.Monad.Primitive.PrimState GHC.Types.IO)
 (GHC.Prim.Any *)))
                   ~#
                 GHC.Types.IO
                   (Data.Vector.Vector
                      (Data.Vector.Mutable.MVector
                         GHC.Prim.RealWorld (GHC.Prim.Any *)))))
     (\ (v_avn
           :: Data.Vector.Vector
                (Data.Vector.Mutable.MVector
                   GHC.Prim.RealWorld (GHC.Prim.Any *))) ->
        GHC.Base.>>=
          @ GHC.Types.IO
          GHC.Base.$fMonadIO
          @ (GHC.Prim.Any
               (* -> *)
               (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)))
          @ ()
          (Data.Vector.Generic.unsafeFreeze
             @ (GHC.Prim.Any (* -> *))
             @ GHC.Types.IO
             @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *))
             Control.Monad.Primitive.$fPrimMonadIO
             $dVector_aFL
             (case cobox_aFM of _ { GHC.Types.Eq# cobox_dN4 ->
              v_avn
              `cast` (cobox_dN4
                      :: Data.Vector.Vector
                           (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *))
                           ~#
                         Data.Vector.Generic.Base.Mutable
                           (GHC.Prim.Any (* -> *))
                           (Control.Monad.Primitive.PrimState GHC.Types.IO)
                           (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)))
              }))
          (\ (iv_avo
                :: GHC.Prim.Any
                     (* -> *)
                     (Data.Vector.Mutable.MVector
                        GHC.Prim.RealWorld (GHC.Prim.Any *))) ->
             GHC.Base.$
               @ (GHC.Prim.Any
                    (* -> *)
                    (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)))
               @ (GHC.Types.IO ())
               (GHC.Base..
                  @ [Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)]
                  @ (GHC.Types.IO ())
                  @ (GHC.Prim.Any
                       (* -> *)
                       (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)))
                  (System.IO.print
                     @ [Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *)]
                     $dShow_aJR)
                  (Data.Vector.Generic.toList
                     @ (GHC.Prim.Any (* -> *))
                     @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld
 (GHC.Prim.Any *))
                     $dVector_aFL))
               iv_avo))

 :Main.main :: GHC.Types.IO ()
 [LclIdX]
 :Main.main = GHC.TopHandler.runMainIO @ () Main.main
 end Rec }

 *** End of Offense ***


 <no location info>:
 Compilation had errors

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8382#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list