summaryrefslogtreecommitdiff
path: root/compiler/ghci/Linker.hs
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-12-17 20:08:58 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-17 20:58:35 -0500
commit52ba9470a7e85d025dc84a6789aa809cdd68b566 (patch)
treeeedb856723fb2dc0101b946af3702e6c6aee18da /compiler/ghci/Linker.hs
parente0fe7c3131c4a18ddd9dd9f2afdd46cafc8cd7ae (diff)
downloadhaskell-52ba9470a7e85d025dc84a6789aa809cdd68b566.tar.gz
Allow use of the external interpreter in stage1.
Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs. Reviewers: simonmar, goldfire, austin, hvr, bgamari Reviewed By: simonmar Subscribers: RyanGlScott, mpickering, angerman, thomie Differential Revision: https://phabricator.haskell.org/D2826
Diffstat (limited to 'compiler/ghci/Linker.hs')
-rw-r--r--compiler/ghci/Linker.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index 7379c46772..6a0483ce1b 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -709,6 +709,16 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods
adjust_ul _ (DotA fp) = panic ("adjust_ul DotA " ++ show fp)
adjust_ul _ (DotDLL fp) = panic ("adjust_ul DotDLL " ++ show fp)
adjust_ul _ l@(BCOs {}) = return l
+#if !MIN_VERSION_filepath(1,4,1)
+ stripExtension :: String -> FilePath -> Maybe FilePath
+ stripExtension [] path = Just path
+ stripExtension ext@(x:_) path = stripSuffix dotExt path
+ where dotExt = if isExtSeparator x then ext else '.':ext
+
+ stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
+ stripSuffix xs ys = fmap reverse $ stripPrefix (reverse xs) (reverse ys)
+#endif
+
{- **********************************************************************