diff options
author | Zubin Duggal <zubin@cmi.ac.in> | 2020-01-08 16:28:28 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-25 00:44:30 -0400 |
commit | 02133353e712e98bfbbc6ed32305b137bb3654eb (patch) | |
tree | 12909a607dd2910501813fc4d0550913ade367be /compiler/GHC/Tc/Gen/Foreign.hs | |
parent | ba205046e4f2ea94b1c978c050b917de4daaf092 (diff) | |
download | haskell-02133353e712e98bfbbc6ed32305b137bb3654eb.tar.gz |
Simplify XRec definition
Change `Located X` usage to `XRec pass X`
This increases the scope of the LPat experiment to almost all of GHC.
Introduce UnXRec and MapXRec classes
Fixes #17587 and #18408
Updates haddock submodule
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
Diffstat (limited to 'compiler/GHC/Tc/Gen/Foreign.hs')
-rw-r--r-- | compiler/GHC/Tc/Gen/Foreign.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs index 902829fb68..7a388d7263 100644 --- a/compiler/GHC/Tc/Gen/Foreign.hs +++ b/compiler/GHC/Tc/Gen/Foreign.hs @@ -6,6 +6,10 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ViewPatterns #-} -- | Typechecking @foreign@ declarations -- @@ -68,13 +72,13 @@ import qualified GHC.LanguageExtensions as LangExt import Control.Monad -- Defines a binding -isForeignImport :: LForeignDecl name -> Bool -isForeignImport (L _ (ForeignImport {})) = True +isForeignImport :: forall name. UnXRec name => LForeignDecl name -> Bool +isForeignImport (unXRec @name -> ForeignImport {}) = True isForeignImport _ = False -- Exports a binding -isForeignExport :: LForeignDecl name -> Bool -isForeignExport (L _ (ForeignExport {})) = True +isForeignExport :: forall name. UnXRec name => LForeignDecl name -> Bool +isForeignExport (unXRec @name -> ForeignExport {}) = True isForeignExport _ = False {- |