{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
module Lambdabot.Config.Telegram where

import Data.Version
import Lambdabot.Config

-- | Telegram Bot Name.
config "telegramBotName"           [t| String                  |] [| "TelegramLambdabot"         |]

-- | Telegram Lambdabot Version.
config "telegramLambdabotVersion"  [t| Version                 |] [| Version [] [] |]

-- | Path to @mueval@ executable.
config "muevalBinary"       [t| String                  |] [| "mueval"      |]


-- | Extensions to enable for the interpreted expression
-- (and probably also @L.hs@ if it doesn't already have these set)
--
-- Some of these settings were propagated from 'lambdabot-haskell-plugins'
-- because @eval@ plugin internals were hidden.
defaultExts :: [String]
defaultExts :: [String]
defaultExts =
    [ String
"ImplicitPrelude" -- workaround for bug in hint package
    , String
"ExtendedDefaultRules"
    , String
"TypeApplications"
    ]

-- | Language extensions used by Telegram Lambdabot: combination of predefined 'defaultExts' and user-defined ones.
configWithMerge [| (++) |] "languageExts"   [t| [String] |] [| defaultExts |]

-- | Predefined packages that are mandatory.
trustedPkgs :: [String]
trustedPkgs :: [String]
trustedPkgs =
    [ String
"array"
    , String
"base"
    , String
"bytestring"
    , String
"containers"
    , String
"lambdabot-trusted"
    , String
"random"
    ]

-- | Set of trusted packages. Combination of predefined 'trustedPkgs' and user-defined ones.
configWithMerge [| (++) |] "trustedPackages"    [t| [String] |] [| trustedPkgs   |]

-- | Command prefixes for fork of @eval@ plugin.
config "evalPrefixes"       [t| [String]                |] [| [">"]         |]

-- | Command to invoke @ghc@.
config "ghcBinary"          [t| String                  |] [| "ghc"         |]

-- | Command to invoke @ghci@.
config "ghciBinary"         [t| String                  |] [| "ghci"        |]