Add numeric instances that network's PortNumber has.
In particular this allows you to use `fromIntegral` without having to add the newtype wrapper. This can help existing code move away from importing and referencing the PortID type altogether.
This commit is contained in:
parent
3334d819b4
commit
f84cc03517
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
-- | Compatibility layer for network package, including newtype 'PortID'
|
-- | Compatibility layer for network package, including newtype 'PortID'
|
||||||
{-# LANGUAGE CPP, PackageImports #-}
|
{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}
|
||||||
|
|
||||||
module Database.MongoDB.Internal.Network (PortID(..), N.HostName, connectTo) where
|
module Database.MongoDB.Internal.Network (PortID(..), N.HostName, connectTo) where
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import System.IO (Handle, IOMode(ReadWriteMode))
|
||||||
|
|
||||||
-- | Wraps network's 'PortNumber'
|
-- | Wraps network's 'PortNumber'
|
||||||
-- Used to ease compatibility between older and newer network versions.
|
-- Used to ease compatibility between older and newer network versions.
|
||||||
newtype PortID = PortNumber N.PortNumber deriving (Show, Eq, Ord)
|
newtype PortID = PortNumber N.PortNumber deriving (Enum, Eq, Integral, Num, Ord, Read, Real, Show)
|
||||||
|
|
||||||
|
|
||||||
#if !MIN_VERSION_network(2, 9, 0)
|
#if !MIN_VERSION_network(2, 9, 0)
|
||||||
|
|
Loading…
Reference in a new issue