[commit: ghc] master: Add NamedThing (GenLocated l e) instance (81b437b)

git at git.haskell.org git at git.haskell.org
Fri Jul 1 12:08:42 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/81b437bcc680745d5d50d731b978a1764f40ab36/ghc

>---------------------------------------------------------------

commit 81b437bcc680745d5d50d731b978a1764f40ab36
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Jul 1 12:23:27 2016 +0200

    Add NamedThing (GenLocated l e) instance


>---------------------------------------------------------------

81b437bcc680745d5d50d731b978a1764f40ab36
 compiler/basicTypes/Name.hs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs
index 24dc8aa..b0411b9 100644
--- a/compiler/basicTypes/Name.hs
+++ b/compiler/basicTypes/Name.hs
@@ -630,6 +630,9 @@ class NamedThing a where
 
     getOccName n = nameOccName (getName n)      -- Default method
 
+instance NamedThing e => NamedThing (GenLocated l e) where
+    getName = getName . unLoc
+
 getSrcLoc           :: NamedThing a => a -> SrcLoc
 getSrcSpan          :: NamedThing a => a -> SrcSpan
 getOccString        :: NamedThing a => a -> String



More information about the ghc-commits mailing list