In the code defining a function, there is a strange "pattern match" (cradleRootDir -> projdir)
I guess that is meant to apply the function inline and binds the result to the name projdir.
What is the name of that construct ?
withGhcModEnv' :: (IOish m, GmOut m) => (FilePath -> (Cradle -> m a) -> m a) -> FilePath -> Options -> ((GhcModEnv, GhcModLog) -> m a) -> m a
withGhcModEnv' withCradle dir opts f =
withCradle dir $ \crdl ->
withCradleRootDir crdl $
f (GhcModEnv opts crdl, undefined)
where
withCradleRootDir (cradleRootDir -> projdir) a = do
cdir <- liftIO $ getCurrentDirectory
eq <- liftIO $ pathsEqual projdir cdir
if not eq
then throw $ GMEWrongWorkingDirectory projdir cdir
else a
The constructor
data Cradle = Cradle {
cradleCurrentDir :: FilePath
, cradleRootDir :: FilePath
, cradleCabalFile :: Maybe FilePath
, cradlePkgDbStack :: [GhcPkgDb]
} deriving (Eq, Show)