{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Data.Extensible.Envy.Instances where
import Data.Extensible (Forall, Instance1)
import qualified Data.Extensible as Ex
import Data.Extensible.Envy
import Data.Kind (Type)
import GHC.TypeLits (KnownSymbol)
import qualified System.Envy as Env
instance Forall (Ex.KeyTargetAre KnownSymbol (Instance1 Env.Var h)) xs
=> Env.FromEnv (Ex.RecordOf (h :: Type -> Type) xs)
where
fromEnv (Just r) = recordFromEnvWithDefault r (defaultFieldLabelToEnvName "")
fromEnv Nothing = recordFromEnv
{-# INLINE fromEnv #-}