mirror of
https://github.com/github/semantic.git
synced 2024-12-20 21:31:48 +03:00
Add helper function to get the path of the current module
This commit is contained in:
parent
4b751034a5
commit
edc2d02559
@ -1,6 +1,7 @@
|
||||
{-# LANGUAGE ConstrainedClassMethods, DataKinds, FunctionalDependencies, TypeFamilies, UndecidableInstances #-}
|
||||
module Control.Abstract.Evaluator
|
||||
( MonadEvaluator(..)
|
||||
, currentModuleFilePath
|
||||
, MonadEnvironment(..)
|
||||
, modifyEnv
|
||||
, modifyExports
|
||||
@ -60,6 +61,9 @@ class ( MonadControl term m
|
||||
-- With great power comes great responsibility. If you 'evaluateModule' any of these, you probably deserve what you get.
|
||||
askModuleStack :: m [Module term]
|
||||
|
||||
-- | Get the path of the current module.
|
||||
currentModuleFilePath :: (MonadEvaluator term value m) => m FilePath
|
||||
currentModuleFilePath = modulePath . head <$> askModuleStack
|
||||
|
||||
-- | A 'Monad' abstracting local and global environments.
|
||||
class Monad m => MonadEnvironment value m | m -> value where
|
||||
|
Loading…
Reference in New Issue
Block a user