diff --git a/libraries/ghc-bignum/ghc-bignum.cabal b/libraries/ghc-bignum/ghc-bignum.cabal index 45bb2b904deaf2b165fd46a95f970f8171042f5e..994a4a6aeabe1269d4a6c8b71d36f92282425a86 100644 --- a/libraries/ghc-bignum/ghc-bignum.cabal +++ b/libraries/ghc-bignum/ghc-bignum.cabal @@ -84,10 +84,14 @@ library ghc-options: -Wall cc-options: -std=c99 -Wall - -- GHC has wired-in IDs from the ghc-bignum package. Hence the unit-id - -- of the package should not contain the version: i.e. it must be - -- "ghc-bignum" and not "ghc-bignum-1.0". - ghc-options: -this-unit-id ghc-bignum + ghc-options: + -- GHC has wired-in IDs from the ghc-bignum package. Hence the unit-id + -- of the package should not contain the version: i.e. it must be + -- "ghc-bignum" and not "ghc-bignum-1.0". + -this-unit-id ghc-bignum + + -- See Note [ghc-bignum and error symbols] + -fno-catch-nonexhaustive-cases if flag(gmp) cpp-options: -DBIGNUM_GMP diff --git a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs index efe78f10c9013a23719c1eaf7286cee6d17ea556..21b07cb8300f14ced57bca5fca9203836b068ce3 100644 --- a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs +++ b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs @@ -1645,3 +1645,22 @@ instance Ord BigNat where BN# a > BN# b = bigNatGt a b BN# a >= BN# b = bigNatGe a b +{- Note [ghc-bignum and error symbols] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ghc-bignum only depends on ghc-prim, not base. +Hence it may not introduce any symbol references to the error symbols in +Control.Exception.Base such as `patError` or `impossibleError`, otherwise +we get linker errors. + +This implies that + + * Every pattern match must be "obviously complete", otherwise GHC's desugaring + inserts `patError`s for the missing cases. "Obviously complete" in the sense + that the desugarer is able to infer completeness, so considering type info + but not long distance information (as the pattern-match checker would do). + * We compile with -fno-catch-nonexhaustive-cases so that we don't risk + introducing `impossibleError` + * ... probably other similar observations that will be added to this list in + the future ... + +-}