{-# LANGUAGE PolyKinds           #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications    #-}

-- Not a fan of @AllowAmbiguousTypes@, but no choice here, /must/ be enabled
-- to export a 'getField' of the correct type.
{-# LANGUAGE AllowAmbiguousTypes #-}

-- | Restore \"regular\" environment when using @RebindableSyntax@
--
-- The @RebindableSyntax@ extension is currently required when using
-- @OverloadedRecordUpdate@, but when using this extension, a number of
-- functions are suddenly no longer in scope that normally are. This module
-- restores those functions to their standard definition.
module Data.Record.Anon.Overloading (
    module Prelude
  , Control.Arrow.app
  , Control.Arrow.arr
  , Control.Arrow.first
  , Control.Arrow.loop
  , (Control.Arrow.>>>)
  , (Control.Arrow.|||)
  , Data.String.fromString
  , GHC.OverloadedLabels.fromLabel
  , GHC.Records.getField
    -- * New definitions
  , ifThenElse
  , setField
  ) where

import qualified Control.Arrow
import qualified Data.String
import qualified GHC.OverloadedLabels
import qualified GHC.Records
import qualified GHC.Records.Compat

{-------------------------------------------------------------------------------
  Other exports
-------------------------------------------------------------------------------}

ifThenElse :: Bool -> a -> a -> a
ifThenElse :: forall a. Bool -> a -> a -> a
ifThenElse Bool
b a
x a
y = if Bool
b then a
x else a
y

setField :: forall x r a. GHC.Records.Compat.HasField x r a => r -> a -> r
setField :: forall {k} (x :: k) r a. HasField x r a => r -> a -> r
setField = forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (x :: k) r a. HasField x r a => r -> (a -> r, a)
GHC.Records.Compat.hasField @x