1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

Don’t return the steps in Either.

This commit is contained in:
Rob Rix 2017-02-24 09:59:29 -05:00
parent 39c49184d3
commit 0f86062a03

View File

@ -33,10 +33,10 @@ run algorithm = case runStep algorithm of
-- | Run an Algorithm to completion, returning the list of steps taken.
runSteps :: (Eq leaf, HasField fields Category, HasField fields (Maybe FeatureVector))
=> Algorithm (SyntaxTerm leaf fields) (SyntaxDiff leaf fields) result
-> [Either result (Algorithm (SyntaxTerm leaf fields) (SyntaxDiff leaf fields) result)]
-> [Algorithm (SyntaxTerm leaf fields) (SyntaxDiff leaf fields) result]
runSteps algorithm = case runStep algorithm of
Left a -> [Left a]
Right next -> Right next : runSteps next
Left a -> [Pure a]
Right next -> next : runSteps next
-- | Run a single step of an Algorithm, returning Either its result if it has finished, or the next step otherwise.
runStep :: (Eq leaf, HasField fields Category, HasField fields (Maybe FeatureVector))