mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
🔥 the value parameter from LoadError.
This commit is contained in:
parent
17c8e024bd
commit
9bf816db3b
@ -62,7 +62,7 @@ sendModules :: Member (Modules address value) effects => Modules address value r
|
||||
sendModules = send
|
||||
|
||||
runModules :: forall term address value effects a
|
||||
. ( Member (Resumable (LoadError address value)) effects
|
||||
. ( Member (Resumable (LoadError address)) effects
|
||||
, Member (State (ModuleTable (Maybe (address, Environment address)))) effects
|
||||
, Member Trace effects
|
||||
)
|
||||
@ -134,26 +134,26 @@ instance Semigroup (Merging' address) where
|
||||
|
||||
|
||||
-- | An error thrown when loading a module from the list of provided modules. Indicates we weren't able to find a module with the given name.
|
||||
data LoadError address value resume where
|
||||
ModuleNotFound :: ModulePath -> LoadError address value (Maybe (address, Environment address))
|
||||
data LoadError address resume where
|
||||
ModuleNotFound :: ModulePath -> LoadError address (Maybe (address, Environment address))
|
||||
|
||||
deriving instance Eq (LoadError address value resume)
|
||||
deriving instance Show (LoadError address value resume)
|
||||
instance Show1 (LoadError address value) where
|
||||
deriving instance Eq (LoadError address resume)
|
||||
deriving instance Show (LoadError address resume)
|
||||
instance Show1 (LoadError address) where
|
||||
liftShowsPrec _ _ = showsPrec
|
||||
instance Eq1 (LoadError address value) where
|
||||
instance Eq1 (LoadError address) where
|
||||
liftEq _ (ModuleNotFound a) (ModuleNotFound b) = a == b
|
||||
|
||||
moduleNotFound :: forall address value effects . Member (Resumable (LoadError address value)) effects => ModulePath -> Evaluator address value effects (Maybe (address, Environment address))
|
||||
moduleNotFound = throwResumable . ModuleNotFound @address @value
|
||||
moduleNotFound :: Member (Resumable (LoadError address)) effects => ModulePath -> Evaluator address value effects (Maybe (address, Environment address))
|
||||
moduleNotFound = throwResumable . ModuleNotFound
|
||||
|
||||
resumeLoadError :: Member (Resumable (LoadError address value)) effects => Evaluator address value effects a -> (forall resume . LoadError address value resume -> Evaluator address value effects resume) -> Evaluator address value effects a
|
||||
resumeLoadError :: Member (Resumable (LoadError address)) effects => Evaluator address value effects a -> (forall resume . LoadError address resume -> Evaluator address value effects resume) -> Evaluator address value effects a
|
||||
resumeLoadError = catchResumable
|
||||
|
||||
runLoadError :: Effectful (m address value) => m address value (Resumable (LoadError address value) ': effects) a -> m address value effects (Either (SomeExc (LoadError address value)) a)
|
||||
runLoadError :: Effectful (m address value) => m address value (Resumable (LoadError address) ': effects) a -> m address value effects (Either (SomeExc (LoadError address)) a)
|
||||
runLoadError = runResumable
|
||||
|
||||
runLoadErrorWith :: Effectful (m address value) => (forall resume . LoadError address value resume -> m address value effects resume) -> m address value (Resumable (LoadError address value) ': effects) a -> m address value effects a
|
||||
runLoadErrorWith :: Effectful (m address value) => (forall resume . LoadError address resume -> m address value effects resume) -> m address value (Resumable (LoadError address) ': effects) a -> m address value effects a
|
||||
runLoadErrorWith = runResumableWith
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ evaluate :: forall address term value effects
|
||||
, Member (Resumable (AddressError address value)) effects
|
||||
, Member (Resumable (EnvironmentError address)) effects
|
||||
, Member (Resumable EvalError) effects
|
||||
, Member (Resumable (LoadError address value)) effects
|
||||
, Member (Resumable (LoadError address)) effects
|
||||
, Member (Resumable ResolutionError) effects
|
||||
, Member (Resumable (Unspecialized value)) effects
|
||||
, Member (State (Heap address (Cell address) value)) effects
|
||||
@ -120,7 +120,7 @@ evaluatePackageWith :: forall proxy lang address term value inner inner' inner''
|
||||
, Member (Resumable (AddressError address value)) outer
|
||||
, Member (Resumable (EnvironmentError address)) outer
|
||||
, Member (Resumable EvalError) outer
|
||||
, Member (Resumable (LoadError address value)) outer
|
||||
, Member (Resumable (LoadError address)) outer
|
||||
, Member (Resumable ResolutionError) outer
|
||||
, Member (Resumable (Unspecialized value)) outer
|
||||
, Member (State (Heap address (Cell address) value)) outer
|
||||
|
@ -85,7 +85,7 @@ newtype GraphEff address a = GraphEff
|
||||
, Resumable EvalError
|
||||
, Resumable (EnvironmentError address)
|
||||
, Resumable (Unspecialized (Value address (GraphEff address)))
|
||||
, Resumable (LoadError address (Value address (GraphEff address)))
|
||||
, Resumable (LoadError address)
|
||||
, Trace
|
||||
, Fresh
|
||||
, State (Heap address Latest (Value address (GraphEff address)))
|
||||
@ -130,7 +130,7 @@ resumingResolutionError = runResolutionErrorWith (\ err -> trace ("ResolutionErr
|
||||
NotFoundError nameToResolve _ _ -> pure nameToResolve
|
||||
GoImportError pathToResolve -> pure [pathToResolve])
|
||||
|
||||
resumingLoadError :: Member Trace effects => Evaluator address value (Resumable (LoadError address value) ': effects) a -> Evaluator address value effects a
|
||||
resumingLoadError :: Member Trace effects => Evaluator address value (Resumable (LoadError address) ': effects) a -> Evaluator address value effects a
|
||||
resumingLoadError = runLoadErrorWith (\ (ModuleNotFound path) -> trace ("LoadError: " <> path) $> Nothing)
|
||||
|
||||
resumingEvalError :: Member Trace effects => Evaluator address value (Resumable EvalError ': effects) a -> Evaluator address value effects a
|
||||
|
@ -56,7 +56,7 @@ newtype UtilEff address a = UtilEff
|
||||
, Resumable (EnvironmentError address)
|
||||
, Resumable ResolutionError
|
||||
, Resumable (Unspecialized (Value address (UtilEff address)))
|
||||
, Resumable (LoadError address (Value address (UtilEff address)))
|
||||
, Resumable (LoadError address)
|
||||
, Trace
|
||||
, Fresh
|
||||
, State (Heap address Latest (Value address (UtilEff address)))
|
||||
|
@ -88,7 +88,7 @@ testEvaluating :: TermEvaluator term Precise
|
||||
, Resumable EvalError, Resumable (EnvironmentError Precise)
|
||||
, Resumable ResolutionError
|
||||
, Resumable (Unspecialized Val)
|
||||
, Resumable (LoadError Precise Val)
|
||||
, Resumable (LoadError Precise)
|
||||
, Fresh
|
||||
, State (Heap Precise Latest Val)
|
||||
, State (ModuleTable (Maybe (Precise, Environment Precise)))
|
||||
@ -104,7 +104,7 @@ testEvaluating :: TermEvaluator term Precise
|
||||
, EnvironmentError Precise
|
||||
, ResolutionError
|
||||
, Unspecialized Val
|
||||
, LoadError Precise Val
|
||||
, LoadError Precise
|
||||
]))
|
||||
[(Value Precise TestEff, Environment Precise)],
|
||||
EvaluatingState Precise Val),
|
||||
@ -140,7 +140,7 @@ newtype TestEff a = TestEff
|
||||
, Resumable (EnvironmentError Precise)
|
||||
, Resumable ResolutionError
|
||||
, Resumable (Unspecialized Val)
|
||||
, Resumable (LoadError Precise Val)
|
||||
, Resumable (LoadError Precise)
|
||||
, Fresh
|
||||
, State (Heap Precise Latest Val)
|
||||
, State (ModuleTable (Maybe (Precise, Environment Precise)))
|
||||
|
Loading…
Reference in New Issue
Block a user