module Unison.CodebasePath
  ( CodebasePath,
    getCodebaseDir,
  )
where

import Control.Monad.IO.Class (MonadIO)
import UnliftIO.Directory (getHomeDirectory)

-- | A directory that contains a codebase.
type CodebasePath = FilePath

getCodebaseDir :: (MonadIO m) => Maybe CodebasePath -> m CodebasePath
getCodebaseDir :: forall (m :: * -> *).
MonadIO m =>
Maybe CodebasePath -> m CodebasePath
getCodebaseDir = m CodebasePath
-> (CodebasePath -> m CodebasePath)
-> Maybe CodebasePath
-> m CodebasePath
forall b a. b -> (a -> b) -> Maybe a -> b
maybe m CodebasePath
forall (m :: * -> *). MonadIO m => m CodebasePath
getHomeDirectory CodebasePath -> m CodebasePath
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure