From 17a3c234ddc51e1df4a556e682a1b11f17fe1db2 Mon Sep 17 00:00:00 2001 From: Joris Putcuyps Date: Sun, 5 Aug 2012 11:41:12 +0200 Subject: [PATCH] Use GHC DeriveDataTypeable to provide a type for SerialPort in stead of quit hack to make it compile. --- System/Hardware/Serialport/Posix.hsc | 11 +++-------- System/Hardware/Serialport/Windows.hs | 6 ++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/System/Hardware/Serialport/Posix.hsc b/System/Hardware/Serialport/Posix.hsc index cb80529..337c892 100644 --- a/System/Hardware/Serialport/Posix.hsc +++ b/System/Hardware/Serialport/Posix.hsc @@ -1,4 +1,4 @@ -{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable #-} {-# OPTIONS_HADDOCK hide #-} module System.Hardware.Serialport.Posix where @@ -13,8 +13,7 @@ import Foreign.C import GHC.IO.Handle import GHC.IO.Device import GHC.IO.BufferedIO -import Data.Typeable.Internal -import GHC.Fingerprint.Type +import Data.Typeable import GHC.IO.Buffer @@ -22,7 +21,7 @@ data SerialPort = SerialPort { fd :: Fd, portSettings :: SerialPortSettings } - + deriving (Typeable) instance RawIO SerialPort where @@ -55,10 +54,6 @@ instance BufferedIO SerialPort where flushWriteBuffer0 = writeBufNonBlocking -instance Typeable SerialPort where - typeOf _ = TypeRep (Fingerprint 0 0) (mkTyCon3 "" "" "") [] - - -- |Open and configure a serial port returning a standard Handle hOpenSerial :: FilePath -> SerialPortSettings diff --git a/System/Hardware/Serialport/Windows.hs b/System/Hardware/Serialport/Windows.hs index 92317e5..8bfa2c5 100644 --- a/System/Hardware/Serialport/Windows.hs +++ b/System/Hardware/Serialport/Windows.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_HADDOCK hide #-} module System.Hardware.Serialport.Windows where @@ -21,6 +22,7 @@ data SerialPort = SerialPort { handle :: HANDLE, portSettings :: SerialPortSettings } + deriving (Typeable) instance RawIO SerialPort where @@ -53,10 +55,6 @@ instance BufferedIO SerialPort where flushWriteBuffer0 = writeBufNonBlocking -instance Typeable SerialPort where - typeOf _ = mkTyConApp (mkTyCon "") [] - - -- |Open and configure a serial port returning a standard Handle. hOpenSerial :: String -> SerialPortSettings