Thanks for the hint. Please correct if I'm wrong.
In this approach, we essentially encode all possible inputs/output of Model
as a
(Either (Either (Either .... (((Either A B) C) D) .... X) Y) Z) Void).
- Will the nested Either's have a performance penalty?
- Does it make sense to make use of the state in Model? ie. should the
'serve' be something like this?
serve
:: (reqLocal -> FreeT remote (State s) respLocal)
-- 'FreeT f (State s)' instead of 'Free'
-> Model s (reqLocal :+: OutputsOf remote) (respLocal :+: InputsOf
remote)
- This might sound silly, but how do I actually write the 'serve' function?
I reckon I'm supposed to write
a Pipe that awaits an input, check if it's local or remote. How do I
actually put these together?
serve
:: (reqLocal -> FreeT remote (State s) respLocal)
-> Model s (reqLocal :+: OutputsOf remote) (respLocal :+: InputsOf
remote)
serve f = asPipe $ do
result <- await
case of result of
Left local -> undefined -- run Free
Right Remote -> undefined -- continue run Free
On Friday, May 2, 2014 11:32:39 AM UTC-7, Michael Thompson wrote:
>
> For some reason `ghc` isn't noticing the possibility that arguments to
> `OutputsOf` are meant to be of kind (* -> *).
>
> There is probably some simpler way of getting it to notice the
> possibility, but if you add something like
>
> {-#Language KindSignatures#-}
>
> then you can write
>
> type family OutputsOf (f :: * -> *) :: *
>
> and similarly for `InputsOf`. Then it compiles
> http://lpaste.net/5936788157725933568
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].