>
> pipeScore :: (Monad m) => Board -> Pipe (Either String Int) (Either
> String ScoreBoard) m ()
> pipeScore = evalStateT $ for untilDone $ \x -> case x of
> Left s -> lift $ yield (Left s)
> Right n -> do
> let y = score n b
> lift $ yield y
> case y of
> Right (Current (_, b')) -> put b'
> _ -> return ()
>
>
This does not seem to compile.
- `for` returns a Pipe, not a StateT
- `n` coming from `untilDone` is actually `ScoreBoard`, not an `Int`.
I am still trying to figure it out alone but with no luck so far ;-)
For instance, this one compiles but does not output anything
pipeScore :: (Monad m) => Board -> Pipe (Either String Int) (Either String
ScoreBoard) m ()
pipeScore = S.evalStateT $ forever $ do
x <- lift $ await
case x of
Left s -> lift $ yield (Left s)
Right n -> do
b <- S.get
let y = score n b
lift $ yield y
case y of
Right (Current (_, b')) -> S.put b'
_ -> return ()
--
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].