mirror of
https://github.com/anoma/juvix.git
synced 2024-12-29 10:33:15 +03:00
97030f8cb4
- ⚠️ Depends on #2644 The `effectful` library does not support the `Embed` effect out of the box. However, it offers `IOE`, which is equivalent to `Embed IO` from polysemy. In preparation to a possible migration to `effectful`, this pr hides the general `Embed` effect from the prelude and it exports a specialized `EmbedIO` in its place.
21 lines
799 B
Haskell
21 lines
799 B
Haskell
module Commands.Dev.MigrateJuvixYaml where
|
|
|
|
import Commands.Base
|
|
import Commands.Dev.MigrateJuvixYaml.Options
|
|
import Commands.Extra.Package
|
|
import Juvix.Extra.Paths
|
|
|
|
runCommand :: forall r. (Members '[EmbedIO, Files, App] r) => MigrateJuvixYamlOptions -> Sem r ()
|
|
runCommand MigrateJuvixYamlOptions {..} = do
|
|
pkgDir <- askPkgDir
|
|
isGlobalPackage <- askPackageGlobal
|
|
let pkgFilePath = pkgDir <//> packageFilePath
|
|
pkgFileExists <- fileExists' pkgFilePath
|
|
pkg <- askPackage
|
|
if
|
|
| isGlobalPackage -> exitMsg (ExitFailure 1) "No Package file found"
|
|
| not pkgFileExists || _migrateJuvixYamlOptionsForce -> do
|
|
writePackageFile pkgDir pkg
|
|
removeFile' (pkgDir <//> juvixYamlFile)
|
|
| otherwise -> exitMsg (ExitFailure 1) (show pkgFilePath <> " already exists.")
|