HIE.Bios.Config

hie-bios-0.14.0: Set up a GHC API session

Safe Haskell | None
Language | Haskell2010

HIE.Bios.Config

Description

Logic and datatypes for parsing `hie.yaml` files.

Synopsis

- readConfig :: FromJSON a => FilePath -> IO (Config a)
- newtype Config a = Config {
  - cradle :: CradleConfig a
  }
- data CradleConfig a = CradleConfig {
  - cradleDependencies :: [FilePath]
  - cradleTree :: CradleTree a
  }
- data CabalType
- pattern CabalType :: Maybe String -> Maybe FilePath -> CabalType
- cabalComponent :: CabalType -> Maybe String
- cabalProjectFile :: CabalType -> Maybe FilePath
- data StackType
- pattern StackType :: Maybe String -> Maybe FilePath -> StackType
- stackComponent :: StackType -> Maybe String
- stackYaml :: StackType -> Maybe FilePath
- data CradleTree a
  - = Cabal {
    - cabalType :: !CabalType
    }
  - | CabalMulti {
    - defaultCabal :: !CabalType
    - subCabalComponents :: [(FilePath, CabalType)]
    }
  - | Stack {
    - stackType :: !StackType
    }
  - | StackMulti {
    - defaultStack :: !StackType
    - subStackComponents :: [(FilePath, StackType)]
    }
  - | Bios {
    - call :: Callable
    - depsCall :: Maybe Callable
    - ghcPath :: Maybe FilePath
    }
  - | Direct {
    - arguments :: [String]
    }
  - | None
  - | Multi [(FilePath, CradleConfig a)]
  - | Other {
    - otherConfig :: a
    - originalYamlValue :: Value
    }
- data Callable
  - = Program FilePath
  - | Command String

# Documentation

readConfig :: FromJSON a => FilePath -> IO (Config a) #

newtype Config a #

Configuration that can be used to load a `Cradle`. A configuration has roughly the following form:

    cradle:
      cabal:
        component: "lib:hie-bios"

Constructors

Config |
Fields cradle :: CradleConfig a

#### Instances

Instances details

Functor Config # |
Instance details Defined in HIE.Bios.Config Methods fmap :: (a -> b) -> Config a -> Config b # (<$) :: a -> Config b -> Config a #
Show (Config a) # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> Config a -> ShowS # show :: Config a -> String # showList :: [Config a] -> ShowS #
Eq a => Eq (Config a) # |
Instance details Defined in HIE.Bios.Config Methods (==) :: Config a -> Config a -> Bool # (/=) :: Config a -> Config a -> Bool #

data CradleConfig a #

Constructors

CradleConfig |
Fields cradleDependencies :: [FilePath] Dependencies of a cradle. Dependencies are expected to be relative to the root directory. The given files are not required to exist. cradleTree :: CradleTree a Type of the cradle to use. Actions to obtain compiler flags from are dependant on this field.

#### Instances

Instances details

Functor CradleConfig # |
Instance details Defined in HIE.Bios.Config Methods fmap :: (a -> b) -> CradleConfig a -> CradleConfig b # (<$) :: a -> CradleConfig b -> CradleConfig a #
Show (CradleConfig a) # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> CradleConfig a -> ShowS # show :: CradleConfig a -> String # showList :: [CradleConfig a] -> ShowS #
Eq a => Eq (CradleConfig a) # |
Instance details Defined in HIE.Bios.Config Methods (==) :: CradleConfig a -> CradleConfig a -> Bool # (/=) :: CradleConfig a -> CradleConfig a -> Bool #

data CabalType #

A cabal yaml configuration consists of component configuration and project configuration.

The former specifies how we can find the compilation flags for any filepath in the project. There might be an explicit mapping from source directories to components, or we let cabal figure it out on its own.

Project configuration is the 'cabal.project' file, we is by default named 'cabal.project'. We allow to override that name to have an HLS specific project configuration file.

#### Instances

Instances details

Monoid CabalType # |
Instance details Defined in HIE.Bios.Config Methods mempty :: CabalType # mappend :: CabalType -> CabalType -> CabalType # mconcat :: [CabalType] -> CabalType #
Semigroup CabalType # |
Instance details Defined in HIE.Bios.Config Methods (<>) :: CabalType -> CabalType -> CabalType # sconcat :: NonEmpty CabalType -> CabalType # stimes :: Integral b => b -> CabalType -> CabalType #
Show CabalType # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> CabalType -> ShowS # show :: CabalType -> String # showList :: [CabalType] -> ShowS #
Eq CabalType # |
Instance details Defined in HIE.Bios.Config Methods (==) :: CabalType -> CabalType -> Bool # (/=) :: CabalType -> CabalType -> Bool #

pattern CabalType :: Maybe String -> Maybe FilePath -> CabalType #

cabalComponent :: CabalType -> Maybe String #

cabalProjectFile :: CabalType -> Maybe FilePath #

data StackType #

#### Instances

Instances details

Monoid StackType # |
Instance details Defined in HIE.Bios.Config Methods mempty :: StackType # mappend :: StackType -> StackType -> StackType # mconcat :: [StackType] -> StackType #
Semigroup StackType # |
Instance details Defined in HIE.Bios.Config Methods (<>) :: StackType -> StackType -> StackType # sconcat :: NonEmpty StackType -> StackType # stimes :: Integral b => b -> StackType -> StackType #
Show StackType # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> StackType -> ShowS # show :: StackType -> String # showList :: [StackType] -> ShowS #
Eq StackType # |
Instance details Defined in HIE.Bios.Config Methods (==) :: StackType -> StackType -> Bool # (/=) :: StackType -> StackType -> Bool #

pattern StackType :: Maybe String -> Maybe FilePath -> StackType #

stackComponent :: StackType -> Maybe String #

stackYaml :: StackType -> Maybe FilePath #

data CradleTree a #

Constructors

Cabal |
Fields cabalType :: !CabalType
CabalMulti |
Fields defaultCabal :: !CabalType subCabalComponents :: [(FilePath, CabalType)]
Stack |
Fields stackType :: !StackType
StackMulti |
Fields defaultStack :: !StackType subStackComponents :: [(FilePath, StackType)]
Bios |
Fields call :: Callable Path to program or shell command that retrieves options to compile a file depsCall :: Maybe Callable Optional path to program or shell command to obtain cradle dependencies. Each cradle dependency is to be expected to be on a separate line and relative to the root dir of the cradle. ghcPath :: Maybe FilePath Optional path to the ghc binary
Direct |
Fields arguments :: [String]
None |
Multi [(FilePath, CradleConfig a)] |
Other |
Fields otherConfig :: a originalYamlValue :: Value

#### Instances

Instances details

Functor CradleTree # |
Instance details Defined in HIE.Bios.Config Methods fmap :: (a -> b) -> CradleTree a -> CradleTree b # (<$) :: a -> CradleTree b -> CradleTree a #
Show (CradleTree a) # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> CradleTree a -> ShowS # show :: CradleTree a -> String # showList :: [CradleTree a] -> ShowS #
Eq a => Eq (CradleTree a) # |
Instance details Defined in HIE.Bios.Config Methods (==) :: CradleTree a -> CradleTree a -> Bool # (/=) :: CradleTree a -> CradleTree a -> Bool #

data Callable #

Constructors

Program FilePath |
Command String |

#### Instances

Instances details

Show Callable # |
Instance details Defined in HIE.Bios.Config Methods showsPrec :: Int -> Callable -> ShowS # show :: Callable -> String # showList :: [Callable] -> ShowS #
Eq Callable # |
Instance details Defined in HIE.Bios.Config Methods (==) :: Callable -> Callable -> Bool # (/=) :: Callable -> Callable -> Bool #