Segmentation fault, runtime representation polymorphism
{-# Language RebindableSyntax, NoImplicitPrelude, MagicHash, RankNTypes, PolyKinds, ViewPatterns, TypeInType, FlexibleInstances #-}
import Prelude hiding (Eq (..), Num(..))
import qualified Prelude as P
import GHC.Prim
import GHC.Types
class Num (a :: TYPE rep) where
(+) :: a -> a -> a
fromInteger :: Integer -> a
instance P.Num a => Num a where
(+) = (P.+)
fromInteger = P.fromInteger
instance Num Int# where (+) = (+#); fromInteger (fromInteger -> I# n) = n
u :: Bool
u = isTrue# v_ where
v_ :: forall rep (a :: TYPE rep). Num a => a
v_ = fromInteger 10
segfaults
$ ./bin/repo/ghc4/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/tMjN.hs
GHCi, version 8.1.20160930: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/tMjN.hs, interpreted )
Ok, modules loaded: Main.
*Main> u
True
*Main> Segmentation fault (core dumped)
$
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |