Make “sublibrary” standard terminology in docs
[cabal.git] / Cabal / src / Distribution / Types / AnnotatedId.hs
blob70c3e1176dd6f8eb60ac99358f282ee15a8559f5
1 {-# LANGUAGE DeriveFunctor #-}
3 module Distribution.Types.AnnotatedId
4 ( AnnotatedId (..)
5 ) where
7 import Distribution.Compat.Prelude
8 import Prelude ()
10 import Distribution.Package
11 import Distribution.Types.ComponentName
13 -- | An 'AnnotatedId' is a 'ComponentId', 'UnitId', etc.
14 -- which is annotated with some other useful information
15 -- that is useful for printing to users, etc.
17 -- Invariant: if ann_id x == ann_id y, then ann_pid x == ann_pid y
18 -- and ann_cname x == ann_cname y
19 data AnnotatedId id = AnnotatedId
20 { ann_pid :: PackageId
21 , ann_cname :: ComponentName
22 , ann_id :: id
24 deriving (Show, Functor)
26 instance Eq id => Eq (AnnotatedId id) where
27 x == y = ann_id x == ann_id y
29 instance Ord id => Ord (AnnotatedId id) where
30 compare x y = compare (ann_id x) (ann_id y)
32 instance Package (AnnotatedId id) where
33 packageId = ann_pid