{-# OPTIONS_GHC -Wno-orphans #-}

module Data.Record.Plugin.WithRDP (
    -- * Annotations
    WithoutRDP.LargeRecordOptions(..)
  , WithoutRDP.largeRecord
    -- * For use by ghc
  , plugin
  ) where

import Control.Monad

import qualified RecordDotPreprocessor as RDP

import Data.Record.Internal.GHC.Shim

import qualified Data.Record.Plugin as WithoutRDP

plugin :: Plugin
plugin :: Plugin
plugin = Plugin
WithoutRDP.plugin forall a. Semigroup a => a -> a -> a
<> Plugin
RDP.plugin

-- | Limited 'Semigroup' instance that defines just enough to combine
-- @large-records@ and @record-dot-preprocessor@
instance Semigroup Plugin where
  Plugin
p <> :: Plugin -> Plugin -> Plugin
<> Plugin
q = Plugin
defaultPlugin {
      parsedResultAction :: [CommandLineOption]
-> ModSummary -> HsParsedModule -> Hsc HsParsedModule
parsedResultAction = \[CommandLineOption]
args ModSummary
summary ->
            Plugin
-> [CommandLineOption]
-> ModSummary
-> HsParsedModule
-> Hsc HsParsedModule
parsedResultAction Plugin
p [CommandLineOption]
args ModSummary
summary
        forall (m :: Type -> Type) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> Plugin
-> [CommandLineOption]
-> ModSummary
-> HsParsedModule
-> Hsc HsParsedModule
parsedResultAction Plugin
q [CommandLineOption]
args ModSummary
summary
    , pluginRecompile :: [CommandLineOption] -> IO PluginRecompile
pluginRecompile = \[CommandLineOption]
args ->
            forall a. Semigroup a => a -> a -> a
(<>)
        forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Plugin -> [CommandLineOption] -> IO PluginRecompile
pluginRecompile Plugin
p [CommandLineOption]
args
        forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> Plugin -> [CommandLineOption] -> IO PluginRecompile
pluginRecompile Plugin
q [CommandLineOption]
args
    }