Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
08ee7c4
typed-protocols: new API
coot Jul 25, 2024
81f2fbe
typed-protocols: Peer pattern synonyms
coot Jul 25, 2024
fe36759
typed-protocols-examples: updated
coot Jul 25, 2024
88d246f
typed-protocols: ActiveAgency
coot Sep 6, 2021
b121a80
typed-protocols: simplify runPeerWithDriver
coot Mar 27, 2022
bdf8100
typed-protocols: internal lemmas module
coot May 23, 2022
564da48
typed-protocols: provide ReflRelativeAgency type aliases
coot Jul 13, 2022
6f5ce41
typed-protocols-examples: socketAsChannel
coot Sep 4, 2021
c69993a
typed-protocols-examples: ReqResp2 example
coot Sep 17, 2021
e4bcf98
typed-protocols-examples: Wedge
coot Sep 18, 2021
86d007a
typed-protocols-examples: requestOnce
coot Sep 28, 2021
b4070d4
typed-protocols-examples: fixed cborg tests
coot Oct 2, 2021
74a64f2
typed-protocols-examples: pipelined tests
coot Oct 2, 2021
5ef5f2d
typed-protocols-examples: unbounded buffered channel
coot Mar 27, 2022
ce833a9
typed-protocols-examples: added runConnectedPeersAsymetric
coot Mar 27, 2022
1ca4aa7
typed-protocols: simplify evidence of termination in a terminal state
coot May 13, 2022
558a9fc
typed-protocols: added StateToken type family to Protocol type class
coot Jun 23, 2022
03270e4
typed-protocols: renamed Pipelined kind to IsPipelined
coot Jul 13, 2022
6b6118d
typed-protocols: added AnyMessageAndAgency pattern synonym
coot Sep 8, 2023
abecdaf
typed-protocols: added application specific singletons for protocol s…
coot Sep 26, 2023
a81caa1
typed-protocols-examples: relaxed constraint in PingPong client
coot Jul 1, 2022
166f5af
typed-protocols-examples: fixed a socket test on macos
coot Aug 17, 2022
f5ccedd
typed-protocols: bump version to `0.2.0.0`
coot Aug 25, 2023
148a91b
Added CHANGELOG and bumped versions of the packages
coot May 17, 2022
6c6a8ce
typed-protocols: moved outstanding counter into IsPipelined kind
coot Jul 23, 2024
d2f1e74
typed-protocols-stateful: non-pipelined stateful Peer
coot Jul 24, 2024
0d9cb77
typed-protocols: moved types to `Core` module
coot Jul 24, 2024
5ec9a8c
typed-protocols: connectPipelined type signature
coot Jul 24, 2024
8d31814
typed-protocols: added PeerPipelined newtype wrapper
coot Jul 24, 2024
b3ba779
Support io-classes-1.7
coot Jul 26, 2024
b23f327
typed-protocols: added haddocks
coot Aug 19, 2024
72a799c
disabled `typed-protocols-doc` in GHA
coot Aug 22, 2024
5cf79f3
stylish-haskell: fixes
coot Aug 22, 2024
b9e71bb
typed-protocols: removed unused extensions
coot Aug 23, 2024
20aa2fe
Improved haddocks, removed unused pragmas (extensions)
coot Aug 23, 2024
bdcf30a
Core module cannot be checked with stylish-haskell
coot Aug 23, 2024
0042b72
Removed Stateful PingPong example
coot Sep 4, 2024
b195c92
Stateful RPC example
coot Sep 5, 2024
f451040
typed-protocols: fixed typos
coot Sep 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
typed-protocols: added StateToken type family to Protocol type class
  • Loading branch information
coot committed Sep 16, 2024
commit 558a9fcecc2d25e2454cc2ab971bbd4c9173535f
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,7 @@ instance Protocol PingPong where
type StateAgency StBusy = ServerAgency
type StateAgency StDone = NobodyAgency

type StateToken = SPingPong


deriving instance Show (Message PingPong from to)
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ instance Protocol (ReqResp req resp) where
type StateAgency StBusy = ServerAgency
type StateAgency StDone = NobodyAgency

type StateToken = SReqResp


deriving instance (Show req, Show resp)
=> Show (Message (ReqResp req resp) from to)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ instance Protocol (ReqResp2 req resp) where
type StateAgency StBusy' = ServerAgency
type StateAgency StDone = NobodyAgency

type StateToken = SReqResp2


deriving instance (Show req, Show resp)
=> Show (Message (ReqResp2 req resp) from to)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ instance Protocol (Wedge ps (stIdle :: ps) ps' (stIdle' :: ps')) where
type StateAgency (StFst st) = StateAgency st
type StateAgency (StSnd st) = StateAgency st

type StateToken = SingWedge


type PingPong2 = Wedge PingPong.PingPong PingPong.StIdle
PingPong.PingPong PingPong.StIdle
Expand Down
12 changes: 12 additions & 0 deletions typed-protocols/src/Network/TypedProtocol/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module Network.TypedProtocol.Core
, IsActiveState (..)
, ActiveState
, notActiveState
-- * Utils
, stateToken
) where

import Data.Kind (Constraint, Type)
Expand Down Expand Up @@ -402,6 +404,16 @@ class Protocol ps where
--
type StateAgency (st :: ps) :: Agency

-- | A type alias for protocol state token, e.g. term level representation of
-- type level state (also known as singleton).
--
type StateToken :: ps -> Type

-- | An alias for 'sing'.
--
stateToken :: (SingI st, Sing st ~ StateToken st) => StateToken st
stateToken = sing

type ActiveAgency' :: ps -> Agency -> Type
data ActiveAgency' st agency where
ClientHasAgency :: StateAgency st ~ ClientAgency
Expand Down