aboutsummaryrefslogtreecommitdiff
path: root/CabalHelper/Common.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2015-10-30 17:15:42 +0100
committerDaniel Gröber <dxld@darkboxed.org>2015-10-30 17:15:42 +0100
commit43f38dec80e082aaaee162817e3a5e8a96458632 (patch)
treec5fc6980c739755434b68461ac53ae592189e4b5 /CabalHelper/Common.hs
parente7e5c3ed1e3d810182904c263063adab02e0cb75 (diff)
Implement workaround for installing 1.18.{0,1}
There are quite a few distributions of cabal-install that are built with these broken versions so we patch them on installation now.
Diffstat (limited to 'CabalHelper/Common.hs')
-rw-r--r--CabalHelper/Common.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/CabalHelper/Common.hs b/CabalHelper/Common.hs
index 154441e..391a842 100644
--- a/CabalHelper/Common.hs
+++ b/CabalHelper/Common.hs
@@ -95,3 +95,11 @@ takeExtension' p =
if takeFileName p == takeExtension p
then "" -- just ".cabal" is not a valid cabal file
else takeExtension p
+
+replace n r h = go "" n r h
+ where
+ go acc n r h
+ | take (length n) h == n =
+ reverse acc ++ r ++ drop (length n) h
+ go acc n r (h:hs) = go (h:acc) n r hs
+ go acc n r [] = reverse acc