Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Commit

Permalink
Use GHC DeriveDataTypeable to provide a type for SerialPort in stead of
Browse files Browse the repository at this point in the history
quit hack to make it compile.
  • Loading branch information
jputcu committed Aug 5, 2012
1 parent eec9a90 commit 17a3c23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
11 changes: 3 additions & 8 deletions System/Hardware/Serialport/Posix.hsc
@@ -1,4 +1,4 @@
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE ForeignFunctionInterface, DeriveDataTypeable #-}
{-# OPTIONS_HADDOCK hide #-}
module System.Hardware.Serialport.Posix where

Expand All @@ -13,16 +13,15 @@ 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


data SerialPort = SerialPort {
fd :: Fd,
portSettings :: SerialPortSettings
}

deriving (Typeable)


instance RawIO SerialPort where
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions System/Hardware/Serialport/Windows.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# OPTIONS_HADDOCK hide #-}
module System.Hardware.Serialport.Windows where

Expand All @@ -21,6 +22,7 @@ data SerialPort = SerialPort {
handle :: HANDLE,
portSettings :: SerialPortSettings
}
deriving (Typeable)


instance RawIO SerialPort where
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 17a3c23

Please sign in to comment.