Update for network-3.1.1.1
This commit is contained in:
parent
b5461747e7
commit
b7071df50b
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.cabal-sandbox
|
||||
cabal.sandbox.config
|
||||
dist
|
||||
.stack-work
|
||||
|
||||
@ -25,14 +25,14 @@ library
|
||||
Database.Memcached.Binary.Types.Exception
|
||||
other-modules: Database.Memcached.Binary.Internal
|
||||
Database.Memcached.Binary.Internal.Definition
|
||||
build-depends: base >=4.6 && <4.11
|
||||
build-depends: base >=4.6 && <5
|
||||
, bytestring >=0.10 && <0.11
|
||||
, network >=2.5 && <2.7
|
||||
, network >=2.5 && <2.7 || >=3.1 && <3.2
|
||||
, storable-endian >=0.2 && <0.3
|
||||
, data-default-class >=0.0 && <0.2
|
||||
, resource-pool >=0.2 && <0.3
|
||||
, unordered-containers >=0.2 && <0.3
|
||||
, time >=1.4 && <1.9
|
||||
, time >=1.4 && <1.10
|
||||
ghc-options: -Wall -O2
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
||||
@ -28,11 +28,20 @@
|
||||
, module Database.Memcached.Binary.Types.Exception
|
||||
-- | def
|
||||
, module Data.Default.Class
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
-- | PortNumber
|
||||
, module Network.Socket
|
||||
#else
|
||||
-- | PortID(..)
|
||||
, module Network
|
||||
#endif
|
||||
) where
|
||||
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
import Network.Socket(PortNumber)
|
||||
#else
|
||||
import Network(PortID(..))
|
||||
#endif
|
||||
|
||||
import Control.Monad
|
||||
|
||||
|
||||
@ -2,10 +2,16 @@
|
||||
{-# LANGUAGE Rank2Types #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE NoMonomorphismRestriction #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Database.Memcached.Binary.Internal where
|
||||
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
import Network.Socket (withSocketsDo)
|
||||
import qualified Network.Socket as NS
|
||||
#else
|
||||
import Network
|
||||
#endif
|
||||
|
||||
import Foreign.Ptr
|
||||
import Foreign.Storable
|
||||
@ -53,6 +59,14 @@ connect' i = loop (connectAuth i)
|
||||
h <- connectTo (connectHost i) (connectPort i)
|
||||
handle (\(_::IOError) -> loop as) $
|
||||
auth a (\_ -> return h) (\_ -> loop as) h
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
connectTo host port = do
|
||||
let hints = NS.defaultHints { NS.addrSocketType = NS.Stream }
|
||||
addr : _ <- NS.getAddrInfo (Just hints) (Just host) (Just $ show port)
|
||||
sock <- NS.socket (NS.addrFamily addr) (NS.addrSocketType addr) (NS.addrProtocol addr)
|
||||
NS.connect sock $ NS.addrAddress addr
|
||||
NS.socketToHandle sock ReadWriteMode
|
||||
#endif
|
||||
|
||||
close :: Connection -> IO ()
|
||||
close (Connection p) = destroyAllResources p
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Database.Memcached.Binary.Types where
|
||||
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
import Network.Socket
|
||||
#else
|
||||
import Network
|
||||
#endif
|
||||
|
||||
import Data.Time.Clock
|
||||
import Data.Word
|
||||
@ -17,7 +23,11 @@ data Auth
|
||||
|
||||
data ConnectInfo = ConnectInfo
|
||||
{ connectHost :: HostName
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
, connectPort :: PortNumber
|
||||
#else
|
||||
, connectPort :: PortID
|
||||
#endif
|
||||
, connectAuth :: [Auth]
|
||||
, numConnection :: Int
|
||||
, connectionIdleTime :: NominalDiffTime
|
||||
@ -28,7 +38,11 @@ data ConnectInfo = ConnectInfo
|
||||
-- def = ConnectInfo "localhost" (PortNumber 11211) [] 1 20
|
||||
-- @
|
||||
instance Default ConnectInfo where
|
||||
#if MIN_VERSION_network(3,0,0)
|
||||
def = ConnectInfo "localhost" 11211 [] 1 20
|
||||
#else
|
||||
def = ConnectInfo "localhost" (PortNumber 11211) [] 1 20
|
||||
#endif
|
||||
|
||||
type Flags = Word32
|
||||
type Key = S.ByteString
|
||||
|
||||
67
stack.yaml
Normal file
67
stack.yaml
Normal file
@ -0,0 +1,67 @@
|
||||
# This file was automatically generated by 'stack init'
|
||||
#
|
||||
# Some commonly used options have been documented as comments in this file.
|
||||
# For advanced use and comprehensive documentation of the format, please see:
|
||||
# https://docs.haskellstack.org/en/stable/yaml_configuration/
|
||||
|
||||
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
|
||||
# A snapshot resolver dictates the compiler version and the set of packages
|
||||
# to be used for project dependencies. For example:
|
||||
#
|
||||
# resolver: lts-3.5
|
||||
# resolver: nightly-2015-09-21
|
||||
# resolver: ghc-7.10.2
|
||||
#
|
||||
# The location of a snapshot can be provided as a file or url. Stack assumes
|
||||
# a snapshot provided as a file might change, whereas a url resource does not.
|
||||
#
|
||||
# resolver: ./custom-snapshot.yaml
|
||||
# resolver: https://example.com/snapshots/2018-01-01.yaml
|
||||
resolver: lts-15.0
|
||||
|
||||
# User packages to be built.
|
||||
# Various formats can be used as shown in the example below.
|
||||
#
|
||||
# packages:
|
||||
# - some-directory
|
||||
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
|
||||
# subdirs:
|
||||
# - auto-update
|
||||
# - wai
|
||||
packages:
|
||||
- .
|
||||
# Dependency packages to be pulled from upstream that are not in the resolver.
|
||||
# These entries can reference officially published versions as well as
|
||||
# forks / in-progress versions pinned to a git hash. For example:
|
||||
#
|
||||
# extra-deps:
|
||||
# - acme-missiles-0.3
|
||||
# - git: https://github.com/commercialhaskell/stack.git
|
||||
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
||||
#
|
||||
extra-deps:
|
||||
- storable-endian-0.2.6
|
||||
|
||||
# Override default flag values for local packages and extra-deps
|
||||
# flags: {}
|
||||
|
||||
# Extra package databases containing global packages
|
||||
# extra-package-dbs: []
|
||||
|
||||
# Control whether we use the GHC we find on the path
|
||||
# system-ghc: true
|
||||
#
|
||||
# Require a specific version of stack, using version ranges
|
||||
# require-stack-version: -any # Default
|
||||
# require-stack-version: ">=2.1"
|
||||
#
|
||||
# Override the architecture used by stack, especially useful on Windows
|
||||
# arch: i386
|
||||
# arch: x86_64
|
||||
#
|
||||
# Extra directories used by stack for building
|
||||
# extra-include-dirs: [/path/to/dir]
|
||||
# extra-lib-dirs: [/path/to/dir]
|
||||
#
|
||||
# Allow a newer minor version of GHC than the snapshot specifies
|
||||
# compiler-check: newer-minor
|
||||
19
stack.yaml.lock
Normal file
19
stack.yaml.lock
Normal file
@ -0,0 +1,19 @@
|
||||
# This file was autogenerated by Stack.
|
||||
# You should not edit this file by hand.
|
||||
# For more information, please see the documentation at:
|
||||
# https://docs.haskellstack.org/en/stable/lock_files
|
||||
|
||||
packages:
|
||||
- completed:
|
||||
hackage: storable-endian-0.2.6@sha256:cae7aac2bfe6037660b2cf294891867e69bcd74e739a3b3ea759e9ad99d6c889,801
|
||||
pantry-tree:
|
||||
size: 223
|
||||
sha256: 6a8e43727f9b146238d4064fffc39d629f06622106922487fea922ec73aaee1e
|
||||
original:
|
||||
hackage: storable-endian-0.2.6
|
||||
snapshots:
|
||||
- completed:
|
||||
size: 488576
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/0.yaml
|
||||
sha256: e4b6a87b47ec1cf63a7f1a0884a3b276fce2b0d174a10e8753c4f618e7983568
|
||||
original: lts-15.0
|
||||
Loading…
Reference in New Issue
Block a user