1 2module Agda.Interaction.Options.Help 3 ( 4 Help (..) 5 , helpTopicUsage 6 , string2HelpTopic 7 , allHelpTopics 8 ) where 9 10import Control.DeepSeq 11 12import GHC.Generics (Generic) 13 14import Agda.Interaction.Options.Warnings 15 16-- | Interface to the @help@ function 17data Help 18 = GeneralHelp 19 -- ^ General usage information 20 | HelpFor HelpTopic 21 -- ^ Specialised usage information about TOPIC 22 deriving (Eq, Show, Generic) 23 24instance NFData Help 25 26-- | List of Help Topics 27-- NOTA BENE: 28-- You need to add each new topic together with its name to @allHelpTopics@ 29 30data HelpTopic 31 = Warning 32 deriving (Eq, Show, Generic) 33 34instance NFData HelpTopic 35 36allHelpTopics :: [(String, HelpTopic)] 37allHelpTopics = [("warning", Warning)] 38 39-- | Usage information generation 40 41helpTopicUsage :: HelpTopic -> String 42helpTopicUsage tp = case tp of 43 Warning -> usageWarning 44 45-- | Conversion functions to strings 46 47string2HelpTopic :: String -> Maybe HelpTopic 48string2HelpTopic str = lookup str allHelpTopics 49 50-- UNUSED Liang-Ting Chen 2019-07-15 51--helpTopic2String :: HelpTopic -> String 52--helpTopic2String w = fromMaybe __IMPOSSIBLE__ $ lookup w (map swap allHelpTopics) 53-- 54