Bus types typecheck!!!
This commit is contained in:
parent
fe2fa21fcc
commit
989c4e9616
3 changed files with 27 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
package BusTypes(
|
||||
Bus(..),
|
||||
ClientTagType,
|
||||
BusClient(..), BusServer(..),
|
||||
BusRequest(..), BusResponse(..),
|
||||
ReadRequest(..), ReadResponse(..), WriteRequest(..), WriteResponse(..),
|
||||
|
@ -8,6 +8,9 @@ package BusTypes(
|
|||
|
||||
import Types
|
||||
import Vector
|
||||
import TagEngine
|
||||
|
||||
type ClientTagType a = (UInt (TLog a))
|
||||
|
||||
data BusError
|
||||
= UnMapped
|
||||
|
@ -68,25 +71,31 @@ data BusResponse
|
|||
-- * From the client's perspective, the response should not be called
|
||||
-- by the arbiter until the client is ready to accept the response.
|
||||
-- In other words, the response method should be guarded by the client.
|
||||
interface (BusClient :: * -> *) transactionTagType =
|
||||
dequeueRequest :: transactionTagType -> ActionValue BusRequest
|
||||
enqueueResponse :: (BusResponse, transactionTagType) -> Action
|
||||
interface (BusClient :: # -> *) inFlightTransactions =
|
||||
dequeueRequest :: TagType inFlightTransactions
|
||||
-> ActionValue BusRequest
|
||||
enqueueResponse :: (BusResponse, TagType inFlightTransactions)
|
||||
-> Action
|
||||
|
||||
-- # BusServer.dequeueResponse
|
||||
-- * If the arbiter is able to successfully call `dequeueResponse`, then
|
||||
-- the BusServer's internal logici must update such that it understand
|
||||
-- the response has been handed off.
|
||||
-- # BusServer.peekClientTagDestination
|
||||
-- * The arbiter looks at (peekClientTagDestination :: clientTagTye) to
|
||||
-- * The arbiter looks at (peekClientTagDestination :: clientTagType) to
|
||||
-- determine whether or not it is currently safe whether to dequeue the
|
||||
-- response as well as where to route the response should it dequeue the
|
||||
-- response.
|
||||
-- * `peekClientTagDestination` should be guarded on whether or not there is
|
||||
-- a valid response available.
|
||||
interface (BusServer :: * -> * -> *) transactionTagType clientTagType =
|
||||
enqueueRequest :: (transactionTagType, BusRequest) -> Action
|
||||
dequeueResponse :: ActionValue (clientTagType, BusResponse, transactionTagType)
|
||||
peekClientTagDestination :: clientTagTye
|
||||
interface (BusServer :: # -> # -> *) inFlightTransactions numClients =
|
||||
enqueueRequest :: (TagType inFlightTransactions, BusRequest)
|
||||
-> Action
|
||||
dequeueResponse :: ActionValue (
|
||||
ClientTagType numClients,
|
||||
BusResponse, transactionTagType
|
||||
)
|
||||
peekClientTagDestination :: clientTagType
|
||||
|
||||
type Token = UInt 5
|
||||
type Numeric = 5
|
||||
|
|
Reference in a new issue