    -- | Configuration of compiler behaviour that is universal to all backends.
    module Futhark.Compiler.Config
      ( FutharkConfig (..),
        newFutharkConfig,
        Verbosity (..),
        CompilerMode (..),
      )
    where

    import Futhark.IR.Syntax.Core (Name)

    -- | Are we compiling a library or an executable?
    data CompilerMode
      = ToLibrary
      | ToExecutable
      | ToServer
      deriving (CompilerMode -> CompilerMode -> Bool
    (CompilerMode -> CompilerMode -> Bool)
    -> (CompilerMode -> CompilerMode -> Bool) -> Eq CompilerMode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: CompilerMode -> CompilerMode -> Bool
    == :: CompilerMode -> CompilerMode -> Bool
    $c/= :: CompilerMode -> CompilerMode -> Bool
    /= :: CompilerMode -> CompilerMode -> Bool
    Eq, Eq CompilerMode
    Eq CompilerMode =>
    (CompilerMode -> CompilerMode -> Ordering)
    -> (CompilerMode -> CompilerMode -> Bool)
    -> (CompilerMode -> CompilerMode -> Bool)
    -> (CompilerMode -> CompilerMode -> Bool)
    -> (CompilerMode -> CompilerMode -> Bool)
    -> (CompilerMode -> CompilerMode -> CompilerMode)
    -> (CompilerMode -> CompilerMode -> CompilerMode)
    -> Ord CompilerMode
    CompilerMode -> CompilerMode -> Bool
    CompilerMode -> CompilerMode -> Ordering
    CompilerMode -> CompilerMode -> CompilerMode
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: CompilerMode -> CompilerMode -> Ordering
    compare :: CompilerMode -> CompilerMode -> Ordering
    $c< :: CompilerMode -> CompilerMode -> Bool
    < :: CompilerMode -> CompilerMode -> Bool
    $c<= :: CompilerMode -> CompilerMode -> Bool
    <= :: CompilerMode -> CompilerMode -> Bool
    $c> :: CompilerMode -> CompilerMode -> Bool
    > :: CompilerMode -> CompilerMode -> Bool
    $c>= :: CompilerMode -> CompilerMode -> Bool
    >= :: CompilerMode -> CompilerMode -> Bool
    $cmax :: CompilerMode -> CompilerMode -> CompilerMode
    max :: CompilerMode -> CompilerMode -> CompilerMode
    $cmin :: CompilerMode -> CompilerMode -> CompilerMode
    min :: CompilerMode -> CompilerMode -> CompilerMode
    Ord, Int -> CompilerMode -> ShowS
    [CompilerMode] -> ShowS
    CompilerMode -> String
    (Int -> CompilerMode -> ShowS)
    -> (CompilerMode -> String)
    -> ([CompilerMode] -> ShowS)
    -> Show CompilerMode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CompilerMode -> ShowS
    showsPrec :: Int -> CompilerMode -> ShowS
    $cshow :: CompilerMode -> String
    show :: CompilerMode -> String
    $cshowList :: [CompilerMode] -> ShowS
    showList :: [CompilerMode] -> ShowS
    Show)

    -- | How much information to print to stderr while the compiler is running.
    data Verbosity
      = -- | Silence is golden.
        NotVerbose
      | -- | Print messages about which pass is running.
        Verbose
      | -- | Also print logs from individual passes.
        VeryVerbose
      deriving (Verbosity -> Verbosity -> Bool
    (Verbosity -> Verbosity -> Bool)
    -> (Verbosity -> Verbosity -> Bool) -> Eq Verbosity
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Verbosity -> Verbosity -> Bool
    == :: Verbosity -> Verbosity -> Bool
    $c/= :: Verbosity -> Verbosity -> Bool
    /= :: Verbosity -> Verbosity -> Bool
    Eq, Eq Verbosity
    Eq Verbosity =>
    (Verbosity -> Verbosity -> Ordering)
    -> (Verbosity -> Verbosity -> Bool)
    -> (Verbosity -> Verbosity -> Bool)
    -> (Verbosity -> Verbosity -> Bool)
    -> (Verbosity -> Verbosity -> Bool)
    -> (Verbosity -> Verbosity -> Verbosity)
    -> (Verbosity -> Verbosity -> Verbosity)
    -> Ord Verbosity
    Verbosity -> Verbosity -> Bool
    Verbosity -> Verbosity -> Ordering
    Verbosity -> Verbosity -> Verbosity
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Verbosity -> Verbosity -> Ordering
    compare :: Verbosity -> Verbosity -> Ordering
    $c< :: Verbosity -> Verbosity -> Bool
    < :: Verbosity -> Verbosity -> Bool
    $c<= :: Verbosity -> Verbosity -> Bool
    <= :: Verbosity -> Verbosity -> Bool
    $c> :: Verbosity -> Verbosity -> Bool
    > :: Verbosity -> Verbosity -> Bool
    $c>= :: Verbosity -> Verbosity -> Bool
    >= :: Verbosity -> Verbosity -> Bool
    $cmax :: Verbosity -> Verbosity -> Verbosity
    max :: Verbosity -> Verbosity -> Verbosity
    $cmin :: Verbosity -> Verbosity -> Verbosity
    min :: Verbosity -> Verbosity -> Verbosity
    Ord)

    -- | The compiler configuration.  This only contains options related
    -- to core compiler functionality, such as reading the initial program
    -- and running passes.  Options related to code generation are handled
    -- elsewhere.
    data FutharkConfig = FutharkConfig
      { FutharkConfig -> (Verbosity, Maybe String)
    futharkVerbose :: (Verbosity, Maybe FilePath),
        -- | Warn if True.
        FutharkConfig -> Bool
    futharkWarn :: Bool,
        -- | If true, error on any warnings.
        FutharkConfig -> Bool
    futharkWerror :: Bool,
        -- | If True, ignore @unsafe@.
        FutharkConfig -> Bool
    futharkSafe :: Bool,
        -- | Additional functions that should be exposed as entry points.
        FutharkConfig -> [Name]
    futharkEntryPoints :: [Name],
        -- | If false, disable type-checking
        FutharkConfig -> Bool
    futharkTypeCheck :: Bool
      }

    -- | The default compiler configuration.
    newFutharkConfig :: FutharkConfig
    newFutharkConfig :: FutharkConfig
    newFutharkConfig =
      FutharkConfig
        { futharkVerbose :: (Verbosity, Maybe String)
    futharkVerbose = (Verbosity
    NotVerbose, Maybe String
    forall a. Maybe a
    Nothing),
          futharkWarn :: Bool
    futharkWarn = Bool
    True,
          futharkWerror :: Bool
    futharkWerror = Bool
    False,
          futharkSafe :: Bool
    futharkSafe = Bool
    False,
          futharkEntryPoints :: [Name]
    futharkEntryPoints = [],
          futharkTypeCheck :: Bool
    futharkTypeCheck = Bool
    True
        }