    module GHC.Driver.Config.Core.Rules
      ( initRuleOpts
      ) where

    import GHC.Prelude

    import GHC.Driver.Flags
    import GHC.Driver.DynFlags ( DynFlags, gopt, targetPlatform, homeUnitId_ )

    import GHC.Core.Rules.Config

    import GHC.Unit.Types     ( primUnitId, bignumUnitId )

    -- | Initialize RuleOpts from DynFlags
    initRuleOpts :: DynFlags -> RuleOpts
    initRuleOpts :: DynFlags -> RuleOpts
    initRuleOpts DynFlags
    dflags = RuleOpts
      { roPlatform :: Platform
    roPlatform                = DynFlags -> Platform
    targetPlatform DynFlags
    dflags
      , roNumConstantFolding :: Bool
    roNumConstantFolding      = GeneralFlag -> DynFlags -> Bool
    gopt GeneralFlag
    Opt_NumConstantFolding DynFlags
    dflags
      , roExcessRationalPrecision :: Bool
    roExcessRationalPrecision = GeneralFlag -> DynFlags -> Bool
    gopt GeneralFlag
    Opt_ExcessPrecision DynFlags
    dflags
        -- disable bignum rules in ghc-prim and ghc-bignum itself
      , roBignumRules :: Bool
    roBignumRules             = DynFlags -> UnitId
    homeUnitId_ DynFlags
    dflags UnitId -> UnitId -> Bool
    forall a. Eq a => a -> a -> Bool
    /= UnitId
    primUnitId
                                    Bool -> Bool -> Bool
    && DynFlags -> UnitId
    homeUnitId_ DynFlags
    dflags UnitId -> UnitId -> Bool
    forall a. Eq a => a -> a -> Bool
    /= UnitId
    bignumUnitId
      }