Skip to content

Commit

Permalink
Fix build with GHC 9.6
Browse files Browse the repository at this point in the history
Version 2.8.0 of `unix' includes a breaking change for openFd, changing
its arity. For now, just use some CPP in order to test for the
appropriate library version.

Related: https://github.com/haskell/unix/releases/tag/v2.8.0.0
  • Loading branch information
slotThe committed Jul 19, 2023
1 parent 92e170f commit 2048f54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/KMonad/Keyboard/IO/Linux/DeviceSource.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveAnyClass #-}
{-|
Module : KMonad.Keyboard.IO.Linux.DeviceSource
Expand Down Expand Up @@ -131,7 +132,11 @@ lsOpen :: (HasLogFunc e)
-> FilePath -- ^ The path to the device file
-> RIO e DeviceFile
lsOpen pr pt = do
#if MIN_VERSION_unix(2,8,0)
h <- liftIO . openFd pt ReadOnly $
#else
h <- liftIO . openFd pt ReadOnly Nothing $
#endif
OpenFileFlags False False False False False
hd <- liftIO $ fdToHandle h
logInfo "Initiating ioctl grab"
Expand Down
2 changes: 1 addition & 1 deletion src/KMonad/Keyboard/IO/Linux/UinputSink.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Data.Time.Clock.System (getSystemTime)

import Foreign.C.String
import Foreign.C.Types
import System.Posix
import System.Posix hiding (sync)
import UnliftIO.Async (async)
import UnliftIO.Process (spawnCommand)

Expand Down

0 comments on commit 2048f54

Please sign in to comment.