definition:
|
getPackageVersionOfModule :: String -> IO (Maybe (String,String))
getPackageVersionOfModule mname = do
mbsrc <- lookupModuleSourceInLoadPath mname
case mbsrc of
Nothing -> error $ "Module '" ++ mname ++ "' not found in load path!"
Just (dirname,_) -> getPackageVersionOfDirectory dirname
|
demand:
|
no demanded arguments
|
deterministic:
|
deterministic operation
|
documentation:
|
Checks whether a module name is part of a package and
returns the package name and package version.
For instance, in a package containing a dependency to package
`process` with version `3.0.0`, the call
getPackageVersionOfModule "System.Process"
returns
Just "process" "3.0.0"
`Nothing` is returned if there is no package to which this module
belongs.
For this purpose, the source file of the module is looked up
(and an error is raised if this module cannot be found) and
it is checked whether there is a `package.json` file under the
directory of the source file and the directory name is a valid package id.
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_) |-> _}
|
name:
|
getPackageVersionOfModule
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
String -> Prelude.IO (Prelude.Maybe (String, String))
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|