typePrimRep invariants

Csaba Hruska csaba.hruska at gmail.com
Fri Nov 30 22:08:44 UTC 2018


Is this problem related to the following?

> {- Note [Error and friends have an "open-tyvar" forall]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 'error' and 'undefined' have types
>         error     :: forall (v :: RuntimeRep) (a :: TYPE v). String -> a
>         undefined :: forall (v :: RuntimeRep) (a :: TYPE v). a
> Notice the runtime-representation polymorphism. This ensures that
> "error" can be instantiated at unboxed as well as boxed types.
> This is OK because it never returns, so the return type is irrelevant.
>
>

On Fri, Nov 30, 2018 at 10:47 PM Csaba Hruska <csaba.hruska at gmail.com>
wrote:

> Hi,
>
> I'd like to export the PrimRep of every binder and data con from Haskell
> modules.
>
> I have a modified GHC 8.6 which serializes the PrimRep for every binder
> during the compilation. It uses the *typePrimRep* function. When my
> customised GHC compiles the base library it always thows the following
> error for the *libraries/base/GHC/Err.hs*
> <https://github.com/grin-tech/ghc-grin/blob/master/ghc-8.6.2/libraries/base/GHC/Err.hs>
> module.
>
>    1. Does that mean that there is hidden requirement for typePrimRep
>    input?
>    2. If so what are the restrictions?
>    3. Can you see anything in the Err module source code that could not
>    be a proper input for typePrimRep function?
>
>
> Thanks,
> Csaba
>
> "inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O
> -Wall      -this-unit-id base-4.12.0.0 -hide-all-packages -i
> -ilibraries/base/. -ilibraries/base/dist-install/build
> -Ilibraries/base/dist-install/build
> -ilibraries/base/dist-install/build/./autogen
> -Ilibraries/base/dist-install/build/./autogen -Ilibraries/base/include
> -Ilibraries/base/dist-install/build/include
> -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
> -optPlibraries/base/dist-install/build/./autogen/cabal_macros.h -package-id
> ghc-prim-0.5.3 -package-id integer-gmp-1.0.2.0 -package-id rts
> -this-unit-id base -Wcompat -Wnoncanonical-monad-instances -XHaskell2010
> -O2 -haddock  -no-user-package-db -rtsopts  -Wno-trustworthy-safe
> -Wno-deprecated-flags     -Wnoncanonical-monad-instances  -odir
> libraries/base/dist-install/build -hidir libraries/base/dist-install/build
> -stubdir libraries/base/dist-install/build  -split-sections -dynamic-too -c
> libraries/base/./GHC/Err.hs -o libraries/base/dist-install/build/GHC/Err.o
> -dyno libraries/base/dist-install/build/GHC/Err.dyn_o
> ghc-stage1: panic! (the 'impossible' happened)
>   (GHC version 8.6.2 for x86_64-unknown-linux):
>     runtimeRepPrimRep
>   typePrimRep (a_a1ML :: TYPE r_a1MK)
>   r_a1MK
>   Call stack:
>       CallStack (from HasCallStack):
>         callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in
> ghc:Outputable
>         pprPanic, called at compiler/simplStg/RepType.hs:358:5 in
> ghc:RepType
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>
> libraries/base/ghc.mk:4: recipe for target
> 'libraries/base/dist-install/build/GHC/Err.o' failed
> make[1]: *** [libraries/base/dist-install/build/GHC/Err.o] Error 1
> Makefile:122: recipe for target 'all' failed
> make: *** [all] Error 2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181130/3ee4e4f2/attachment.html>


More information about the ghc-devs mailing list