{-# OPTIONS_GHC -Wno-orphans #-}
module Ide.Plugin.Cabal.Orphans where
import           Control.DeepSeq
import           Distribution.Fields.Field
import           Distribution.Parsec.Position

-- ----------------------------------------------------------------
-- Cabal-syntax orphan instances we need sometimes
-- ----------------------------------------------------------------

instance NFData (Field Position) where
    rnf :: Field Position -> ()
rnf (Field Name Position
name [FieldLine Position]
fieldLines) = Name Position -> ()
forall a. NFData a => a -> ()
rnf Name Position
name () -> () -> ()
forall a b. a -> b -> b
`seq` [FieldLine Position] -> ()
forall a. NFData a => a -> ()
rnf [FieldLine Position]
fieldLines
    rnf (Section Name Position
name [SectionArg Position]
sectionArgs [Field Position]
fields) =  Name Position -> ()
forall a. NFData a => a -> ()
rnf Name Position
name () -> () -> ()
forall a b. a -> b -> b
`seq` [SectionArg Position] -> ()
forall a. NFData a => a -> ()
rnf [SectionArg Position]
sectionArgs () -> () -> ()
forall a b. a -> b -> b
`seq` [Field Position] -> ()
forall a. NFData a => a -> ()
rnf [Field Position]
fields

instance NFData (Name Position) where
    rnf :: Name Position -> ()
rnf (Name Position
ann FieldName
fName) = Position -> ()
forall a. NFData a => a -> ()
rnf Position
ann () -> () -> ()
forall a b. a -> b -> b
`seq` FieldName -> ()
forall a. NFData a => a -> ()
rnf FieldName
fName

instance NFData (FieldLine Position) where
    rnf :: FieldLine Position -> ()
rnf (FieldLine Position
ann FieldName
bs) = Position -> ()
forall a. NFData a => a -> ()
rnf Position
ann () -> () -> ()
forall a b. a -> b -> b
`seq` FieldName -> ()
forall a. NFData a => a -> ()
rnf FieldName
bs

instance NFData (SectionArg Position) where
    rnf :: SectionArg Position -> ()
rnf (SecArgName Position
ann FieldName
bs)  = Position -> ()
forall a. NFData a => a -> ()
rnf Position
ann () -> () -> ()
forall a b. a -> b -> b
`seq` FieldName -> ()
forall a. NFData a => a -> ()
rnf FieldName
bs
    rnf (SecArgStr Position
ann FieldName
bs)   = Position -> ()
forall a. NFData a => a -> ()
rnf Position
ann () -> () -> ()
forall a b. a -> b -> b
`seq` FieldName -> ()
forall a. NFData a => a -> ()
rnf FieldName
bs
    rnf (SecArgOther Position
ann FieldName
bs) = Position -> ()
forall a. NFData a => a -> ()
rnf Position
ann () -> () -> ()
forall a b. a -> b -> b
`seq` FieldName -> ()
forall a. NFData a => a -> ()
rnf FieldName
bs