summaryrefslogtreecommitdiff
path: root/compiler/main/Annotations.hs
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-06-08 20:48:07 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-06-09 14:35:50 +0200
commit4c44e323e8ac0e28e87e93ab53cbf7eb21ac9c25 (patch)
treeb0991218e9cac8f76224df017856045c71d779e4 /compiler/main/Annotations.hs
parent8754002973dcde8709458044e541ddc8f4fcf6bb (diff)
downloadhaskell-wip/derive-functor.tar.gz
Use DeriveFunctor throughout the codebase (#15654)wip/derive-functor
Diffstat (limited to 'compiler/main/Annotations.hs')
-rw-r--r--compiler/main/Annotations.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/main/Annotations.hs b/compiler/main/Annotations.hs
index f6d5a1cb12..82d80aae43 100644
--- a/compiler/main/Annotations.hs
+++ b/compiler/main/Annotations.hs
@@ -4,6 +4,7 @@
-- (c) The University of Glasgow 2006
-- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
--
+{-# LANGUAGE DeriveFunctor #-}
module Annotations (
-- * Main Annotation data types
Annotation(..), AnnPayload,
@@ -49,14 +50,11 @@ data AnnTarget name
= NamedTarget name -- ^ We are annotating something with a name:
-- a type or identifier
| ModuleTarget Module -- ^ We are annotating a particular module
+ deriving (Functor)
-- | The kind of annotation target found in the middle end of the compiler
type CoreAnnTarget = AnnTarget Name
-instance Functor AnnTarget where
- fmap f (NamedTarget nm) = NamedTarget (f nm)
- fmap _ (ModuleTarget mod) = ModuleTarget mod
-
-- | Get the 'name' of an annotation target if it exists.
getAnnTargetName_maybe :: AnnTarget name -> Maybe name
getAnnTargetName_maybe (NamedTarget nm) = Just nm