3
0
Fork 0
forked from mirrors/nixpkgs

haskellPackages.knob: remove patch after 0.2

This commit is contained in:
Naïm Favier 2022-03-26 09:59:24 +01:00 committed by sternenseemann
parent 27aed0d10b
commit ad560b3ef4
3 changed files with 0 additions and 66 deletions

View file

@ -2476,8 +2476,6 @@ self: super: {
# https://github.com/kuribas/mfsolve/issues/8
mfsolve = dontCheck super.mfsolve;
knob = appendPatch ./patches/knob-ghc9.patch super.knob;
# compatibility with random-fu 0.3 https://github.com/mokus0/misfortune/pull/5
misfortune = appendPatch ./patches/misfortune-ghc9.patch (overrideCabal (drv: {
revision = null;

View file

@ -61,8 +61,6 @@ self: super: {
# Tests fail in GHC 9.2
extra = dontCheck super.extra;
knob = appendPatch ./patches/knob-ghc9.patch super.knob;
# Jailbreaks & Version Updates
# This `doJailbreak` can be removed once we have doctest v0.20

View file

@ -1,62 +0,0 @@
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