diff options
author | Naïm Favier <n@monade.li> | 2022-03-16 02:06:15 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-03-16 02:10:08 +0100 |
commit | 0ba189f2d7ba8f6c225fbea2a6b4ba2e037a70b7 (patch) | |
tree | 1f2ea714368e4094a75c30108c65c1483ed0596e /pkgs/development/haskell-modules/patches | |
parent | bb72482cc3eb6f6604641a246ce26bc8c3dff627 (diff) |
haskellPackages.knob: add patch for GHC 9 support
Patch sent to upstream via email, but the package hasn't been updated in ten years. Changes: - IO.seek should now return the new offset so I used modifyMVar instead of modifyMVar_ - mkFileHandle now requires a RawIO instance for Device. Since this was not the case before and I don't think we need to actually support raw IO, I used DeriveAnyClass.
Diffstat (limited to 'pkgs/development/haskell-modules/patches')
-rw-r--r-- | pkgs/development/haskell-modules/patches/knob-ghc9.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/patches/knob-ghc9.patch b/pkgs/development/haskell-modules/patches/knob-ghc9.patch new file mode 100644 index 0000000000000..9316f1c29d31e --- /dev/null +++ b/pkgs/development/haskell-modules/patches/knob-ghc9.patch @@ -0,0 +1,62 @@ +diff --git a/knob.cabal b/knob.cabal +index a8abae0..45bd5c7 100644 +--- a/knob.cabal ++++ b/knob.cabal +@@ -52,7 +52,7 @@ library + ghc-options: -Wall -O2 + + build-depends: +- base >= 4.2 && < 4.15 ++ base >= 4.2 && < 5 + , bytestring >= 0.9 + , transformers >= 0.2 + +diff --git a/lib/Data/Knob.hs b/lib/Data/Knob.hs +index fa87ad2..f01d0a7 100644 +--- a/lib/Data/Knob.hs ++++ b/lib/Data/Knob.hs +@@ -1,4 +1,4 @@ +-{-# LANGUAGE DeriveDataTypeable #-} ++{-# LANGUAGE DeriveDataTypeable, DeriveAnyClass #-} + + -- | + -- Module: Data.Knob +@@ -58,7 +58,7 @@ import qualified System.IO as IO + newtype Knob = Knob (MVar.MVar ByteString) + + data Device = Device IO.IOMode (MVar.MVar ByteString) (MVar.MVar Int) +- deriving (Typeable) ++ deriving (Typeable, IO.RawIO) + + instance IO.IODevice Device where + ready _ _ _ = return True +@@ -68,21 +68,21 @@ instance IO.IODevice Device where + + seek (Device _ _ var) IO.AbsoluteSeek off = do + checkOffset off +- MVar.modifyMVar_ var (\_ -> return (fromInteger off)) +- ++ MVar.modifyMVar var (\_ -> return (fromInteger off, off)) ++ + seek (Device _ _ var) IO.RelativeSeek off = do +- MVar.modifyMVar_ var (\old_off -> do ++ MVar.modifyMVar var (\old_off -> do + let new_off = toInteger old_off + off + checkOffset new_off +- return (fromInteger new_off)) +- ++ return (fromInteger new_off, new_off)) ++ + seek dev@(Device _ _ off_var) IO.SeekFromEnd off = do +- MVar.modifyMVar_ off_var (\_ -> do ++ MVar.modifyMVar off_var (\_ -> do + size <- IO.getSize dev + let new_off = size + off + checkOffset new_off +- return (fromInteger new_off)) +- ++ return (fromInteger new_off, new_off)) ++ + tell (Device _ _ var) = fmap toInteger (MVar.readMVar var) + getSize (Device _ var _) = do + bytes <- MVar.readMVar var |