Verified Commit 30b24c77 authored by Allele Dev's avatar Allele Dev

core: tighter CanShutdown constraints

parent 3197ed33
# linear-socket
| linear-socket | 0.3.1.0 |
| linear-socket | 0.3.2.0 |
| ------------- | --------------------------------- |
| Maintainer | Allele Dev ([email protected]) |
| Funding | $0 USD |
......
# 0.3.2.0 (Dec. 3, 2017)
* make CanShutdown constraints tighter
# 0.3.1.0 (Dec. 2, 2017)
* added socket creation functions that make things easier to use
......
......@@ -3,7 +3,7 @@
-- see: https://github.com/sol/hpack
name: linear-socket
version: 0.3.1.0
version: 0.3.2.0
synopsis: Initial project template from stack
description: Please see README.md
license: GPL-3
......
name: linear-socket
version: '0.3.1.0'
version: '0.3.2.0'
synopsis: Initial project template from stack
description: Please see README.md
category: Web
......
......@@ -180,21 +180,21 @@ makeAddrReusable s = setSocketOption NS.ReuseAddr 0 s >> return s
-- Socket termination
----------------------------------------
shutdownReceive ::
CanShutdownReceive sh ~ 'True =>
CanShutdownReceive sh s ~ 'True =>
SSocket f p s sh
-> IO (SSocket f p s (Shutdown sh 'NS.ShutdownReceive))
shutdownReceive (SSocket s) =
NS.shutdown s NS.ShutdownReceive >> return (SSocket s)
shutdownSend ::
CanShutdownSend sh ~ 'True =>
CanShutdownSend sh s ~ 'True =>
SSocket f p s sh
-> IO (SSocket f p s (Shutdown sh 'NS.ShutdownSend))
shutdownSend (SSocket s) =
NS.shutdown s NS.ShutdownSend >> return (SSocket s)
shutdownBoth ::
CanShutdownBoth sh ~ 'True =>
CanShutdownBoth sh s ~ 'True =>
SSocket f p s sh
-> IO (SSocket f p s (Shutdown sh 'NS.ShutdownBoth))
shutdownBoth (SSocket s) =
......@@ -301,16 +301,21 @@ type family Shutdown (sh :: ShutdownStatus) (cmd :: NS.ShutdownCmd)
Shutdown 'CannotSend 'NS.ShutdownReceive = 'CannotSendOrReceive
Shutdown 'CannotReceive 'NS.ShutdownSend = 'CannotSendOrReceive
type family CanShutdownReceive (sh :: ShutdownStatus) :: Bool where
CanShutdownReceive 'Available = 'True
CanShutdownReceive 'CannotSend = 'True
type family CanShutdownSend (sh :: ShutdownStatus) :: Bool where
CanShutdownSend 'Available = 'True
CanShutdownSend 'CannotReceive = 'True
type family CanShutdownBoth (sh :: ShutdownStatus) :: Bool where
CanShutdownBoth 'Available = 'True
type family CanShutdownReceive (sh :: ShutdownStatus) (s :: SocketStatus) :: Bool where
CanShutdownReceive 'Available 'Connected = 'True
CanShutdownReceive 'CannotSend 'Connected = 'True
CanShutdownReceive 'Available 'Listening = 'True
CanShutdownReceive 'CannotSend 'Listening = 'True
type family CanShutdownSend (sh :: ShutdownStatus) (s :: SocketStatus) :: Bool where
CanShutdownSend 'Available 'Connected = 'True
CanShutdownSend 'CannotSend 'Connected = 'True
CanShutdownSend 'Available 'Listening = 'True
CanShutdownSend 'CannotSend 'Listening = 'True
type family CanShutdownBoth (sh :: ShutdownStatus) (s :: SocketStatus) :: Bool where
CanShutdownBoth 'Available 'Connected = 'True
CanShutdownBoth 'Available 'Listening = 'True
type family CanSend (sh :: ShutdownStatus) :: Bool where
CanSend 'Available = 'True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment