1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Fix SpecHelpers.

Man, this is a monster of a file.
This commit is contained in:
Patrick Thomson 2019-11-08 22:43:09 -05:00
parent 2e39e129cd
commit b9388d1d20

View File

@ -24,9 +24,13 @@ module SpecHelpers
) where
import Control.Abstract
import Control.Carrier.Fresh.Strict
import Control.Carrier.Parse.Simple
import Control.Effect.Lift
import Control.Effect.Trace as X (runTraceByIgnoring, runTraceByReturning)
import Control.Carrier.Reader
import qualified Control.Carrier.Trace.Ignoring as Trace.Ignoring
import Control.Carrier.Resumable.Either
import Control.Carrier.Lift
import Control.Carrier.State.Strict
import Control.Exception (displayException)
import Control.Monad ((>=>))
import Control.Monad as X
@ -101,7 +105,7 @@ parseFilePath session path = do
res <- runTask session . runParse (configTreeSitterParseTimeout (config session)) . runReader defaultLanguageModes $ parseTermBuilder TermSExpression (toList blob)
pure (runBuilder <$> res)
runParseWithConfig :: (Carrier sig m, Member (Reader Config) sig) => ParseC m a -> m a
runParseWithConfig :: Has (Reader Config) sig m => ParseC m a -> m a
runParseWithConfig task = asks configTreeSitterParseTimeout >>= \ timeout -> runParse timeout task
-- | Read two files to a BlobPair.
@ -124,7 +128,7 @@ type TestEvaluatingC term
( StateC (Heap Precise Precise (Val term))
( StateC (ScopeGraph Precise)
( FreshC
( TraceByIgnoringC
( Trace.Ignoring.TraceC
( LiftC IO))))))))))))
type TestEvaluatingErrors term
= '[ BaseError (AddressError Precise (Val term))
@ -147,8 +151,9 @@ testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) a
-> IO (TestEvaluatingState term a)
testEvaluating
= runM
. runTraceByIgnoring
. runFresh
. Trace.Ignoring.runTrace
. fmap snd
. runFresh 0
. runEvaluator
. runScopeGraph
. runHeap