{-# OPTIONS_GHC -fno-warn-orphans #-}

module Language.Haskell.GHC.ExactPrint.Orphans where

import Data.Default
import GHC hiding (EpaComment)

-- ---------------------------------------------------------------------

-- ---------------------------------------------------------------------
-- Orphan Default instances. See https://gitlab.haskell.org/ghc/ghc/-/issues/20372

{-
instance Default [a] where
  def = []
-}
instance Default NameAnn where
  def :: NameAnn
def = NameAnn
forall a. Monoid a => a
mempty

instance Default AnnList where
  def :: AnnList
def = AnnList
forall a. Monoid a => a
mempty

instance Default AnnListItem where
  def :: AnnListItem
def = AnnListItem
forall a. Monoid a => a
mempty

instance Default AnnPragma where
  def :: AnnPragma
def = AddEpAnn -> AddEpAnn -> [AddEpAnn] -> AnnPragma
AnnPragma AddEpAnn
forall a. Default a => a
def AddEpAnn
forall a. Default a => a
def [AddEpAnn]
forall a. Default a => a
def

instance Semigroup EpAnnImportDecl where
  <> :: EpAnnImportDecl -> EpAnnImportDecl -> EpAnnImportDecl
(<>) = [Char] -> EpAnnImportDecl -> EpAnnImportDecl -> EpAnnImportDecl
forall a. HasCallStack => [Char] -> a
error [Char]
"unimplemented"
instance Default EpAnnImportDecl where
  def :: EpAnnImportDecl
def = EpaLocation
-> Maybe (EpaLocation, EpaLocation)
-> Maybe EpaLocation
-> Maybe EpaLocation
-> Maybe EpaLocation
-> Maybe EpaLocation
-> EpAnnImportDecl
EpAnnImportDecl EpaLocation
forall a. Default a => a
def  Maybe (EpaLocation, EpaLocation)
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing

instance Default HsRuleAnn where
  def :: HsRuleAnn
def = Maybe (AddEpAnn, AddEpAnn)
-> Maybe (AddEpAnn, AddEpAnn) -> [AddEpAnn] -> HsRuleAnn
HsRuleAnn Maybe (AddEpAnn, AddEpAnn)
forall a. Maybe a
Nothing Maybe (AddEpAnn, AddEpAnn)
forall a. Maybe a
Nothing [AddEpAnn]
forall a. Default a => a
def

instance Default AnnSig where
  def :: AnnSig
def = AddEpAnn -> [AddEpAnn] -> AnnSig
AnnSig AddEpAnn
forall a. Default a => a
def  [AddEpAnn]
forall a. Default a => a
def

instance Default GrhsAnn where
  def :: GrhsAnn
def = Maybe EpaLocation -> AddEpAnn -> GrhsAnn
GrhsAnn Maybe EpaLocation
forall a. Maybe a
Nothing  AddEpAnn
forall a. Default a => a
def

instance Default EpAnnUnboundVar where
  def :: EpAnnUnboundVar
def = (EpaLocation, EpaLocation) -> EpaLocation -> EpAnnUnboundVar
EpAnnUnboundVar (EpaLocation, EpaLocation)
forall a. Default a => a
def  EpaLocation
forall a. Default a => a
def

{-
instance (Default a, Default b) => Default (a, b) where
  def = (def, def)
-}

instance Default NoEpAnns where
  def :: NoEpAnns
def = NoEpAnns
NoEpAnns

instance Default AnnParen where
  def :: AnnParen
def = ParenType -> EpaLocation -> EpaLocation -> AnnParen
AnnParen ParenType
AnnParens EpaLocation
forall a. Default a => a
def  EpaLocation
forall a. Default a => a
def

instance Default AnnExplicitSum where
  def :: AnnExplicitSum
def = EpaLocation
-> [EpaLocation] -> [EpaLocation] -> EpaLocation -> AnnExplicitSum
AnnExplicitSum EpaLocation
forall a. Default a => a
def  [EpaLocation]
forall a. Default a => a
def  [EpaLocation]
forall a. Default a => a
def  EpaLocation
forall a. Default a => a
def

instance Default EpAnnHsCase where
  def :: EpAnnHsCase
def = EpaLocation -> EpaLocation -> [AddEpAnn] -> EpAnnHsCase
EpAnnHsCase EpaLocation
forall a. Default a => a
def EpaLocation
forall a. Default a => a
def [AddEpAnn]
forall a. Default a => a
def

instance Default AnnsIf where
  def :: AnnsIf
def = EpaLocation
-> EpaLocation
-> EpaLocation
-> Maybe EpaLocation
-> Maybe EpaLocation
-> AnnsIf
AnnsIf EpaLocation
forall a. Default a => a
def EpaLocation
forall a. Default a => a
def EpaLocation
forall a. Default a => a
def Maybe EpaLocation
forall a. Default a => a
def Maybe EpaLocation
forall a. Default a => a
def

{-
instance Default (Maybe a) where
  def = Nothing
-}

instance Default AnnProjection where
  def :: AnnProjection
def = EpaLocation -> EpaLocation -> AnnProjection
AnnProjection EpaLocation
forall a. Default a => a
def EpaLocation
forall a. Default a => a
def

instance Default AnnFieldLabel where
  def :: AnnFieldLabel
def = Maybe EpaLocation -> AnnFieldLabel
AnnFieldLabel Maybe EpaLocation
forall a. Maybe a
Nothing

instance Default EpaLocation where
  def :: EpaLocation
def = DeltaPos -> [LEpaComment] -> EpaLocation
EpaDelta (Int -> DeltaPos
SameLine Int
0) []

instance Default AddEpAnn where
  def :: AddEpAnn
def = AnnKeywordId -> EpaLocation -> AddEpAnn
AddEpAnn AnnKeywordId
forall a. Default a => a
def EpaLocation
forall a. Default a => a
def

instance Default AnnKeywordId where
  def :: AnnKeywordId
def = AnnKeywordId
Annlarrowtail  {- gotta pick one -}

instance Default AnnContext where
  def :: AnnContext
def = Maybe (IsUnicodeSyntax, EpaLocation)
-> [EpaLocation] -> [EpaLocation] -> AnnContext
AnnContext Maybe (IsUnicodeSyntax, EpaLocation)
forall a. Maybe a
Nothing [] []

instance Default EpAnnSumPat where
  def :: EpAnnSumPat
def = [AddEpAnn] -> [EpaLocation] -> [EpaLocation] -> EpAnnSumPat
EpAnnSumPat [AddEpAnn]
forall a. Default a => a
def  [EpaLocation]
forall a. Default a => a
def  [EpaLocation]
forall a. Default a => a
def

instance Default AnnsModule where
  def :: AnnsModule
def = [AddEpAnn] -> AnnList -> AnnsModule
AnnsModule [] AnnList
forall a. Monoid a => a
mempty