-- | Convert a module name to a relative filename, minus the
-- extension, or fail for some reason.
moduleFileName :: Text -> Except LoadRefusal P.FilePath
moduleFileName modName = do
  let modName' = modName ^.. text
  null (invalidChars modName) `unless` throwE NoFilenameMapping
  let relPath = set (mapped.filtered ('.'==)) P.pathSeparator modName'
  P.isValid relPath `unless` throwE NoFilenameMapping
  return relPath
moduleFileName :: Text -> Except LoadRefusal P.FilePath
moduleFileName modName = do
  let modName' = modName ^.. text
  null (invalidChars modName) `unless` throwE NoFilenameMapping
  let relPath = set (mapped.filtered ('.'==)) P.pathSeparator modName'
  P.isValid relPath `unless` throwE NoFilenameMapping
  return relPath
moduleFileName modName = do
  let modName' = modName ^.. text
  null (invalidChars modName) `unless` throwE NoFilenameMapping
  let relPath = set (mapped.filtered ('.'==)) P.pathSeparator modName'
  P.isValid relPath `unless` throwE NoFilenameMapping
  return relPath