| Copyright | (c) Frederick Pringle 2023 |
|---|---|
| License | BSD-3-Clause |
| Maintainer | freddyjepringle@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Hoyo.Internal.Types
Description
Types used by all the main Hoyo.* modules.
Synopsis
- data Env = Env {
- _bookmarks :: !Bookmarks
- _bookmarksPath :: !FilePath
- _config :: !Config
- _configPath :: !FilePath
- data Bookmark = Bookmark {}
- data DefaultBookmark = DefaultBookmark {}
- newtype Bookmarks = Bookmarks {
- unBookmarks :: [Bookmark]
- data BookmarkSearchTerm
- data ConfigValueType
- data ConfigValue (t :: ConfigValueType) where
- BoolV :: Bool -> ConfigValue 'TBool
- DefaultBookmarkV :: DefaultBookmark -> ConfigValue 'TDefaultBookmark
- CommandV :: Command -> ConfigValue 'TCommand
- ListOfV :: forall (a :: ConfigValueType). [ConfigValue a] -> ConfigValue ('TList a)
- MaybeV :: forall (a :: ConfigValueType). Maybe (ConfigValue a) -> ConfigValue ('TMaybe a)
- data AnyConfigValue = forall (t :: ConfigValueType). AnyConfigValue (ConfigValue t)
- data Config = Config {
- _failOnError :: !(ConfigValue 'TBool)
- _displayCreationTime :: !(ConfigValue 'TBool)
- _enableClearing :: !(ConfigValue 'TBool)
- _enableReset :: !(ConfigValue 'TBool)
- _backupBeforeClear :: !(ConfigValue 'TBool)
- _defaultBookmarks :: !(ConfigValue ('TList 'TDefaultBookmark))
- _defaultCommand :: !(ConfigValue ('TMaybe 'TCommand))
- data SearchException
- data CommandException
- data FileSystemException
- data HoyoException
- newtype HoyoMonad a = HoyoMonad {}
- data AddOptions = AddOptions {
- addDirectory :: FilePath
- addName :: Maybe Text
- newtype MoveOptions = MoveOptions {}
- data ListOptions = ListOptions {}
- data ClearOptions = ClearOptions
- newtype DeleteOptions = DeleteOptions {}
- data RefreshOptions = RefreshOptions
- newtype ConfigPrintOptions = ConfigPrintOptions {}
- data ConfigResetOptions = ConfigResetOptions
- data ConfigSetOptions = ConfigSetOptions {}
- data ConfigAddDefaultOptions = ConfigAddDefaultOptions {}
- data ConfigCommand
- data CheckOptions = CheckOptions {}
- newtype HelpOptions = HelpOptions {}
- data Command
- data MaybeOverride
- data OverrideOptions = OverrideOptions {}
- data GlobalOptions = GlobalOptions {}
- data Options = Options {}
Documentation
The main hoyo read-only environment. Contains the current saved bookmarks, the current hoyo configuration, and the file locations for each.
Constructors
| Env | |
Fields
| |
Bookmark a directory for easy cd. A bookmark remembers the directory,
the index, the creation time, and optionally a user-specified nickname
for the bookmark.
Constructors
| Bookmark | |
Fields
| |
Instances
data DefaultBookmark Source #
Default bookmarks to save at init. A default bookmark remembers the directory and optionally a user-specified nickname for the bookmark.
Constructors
| DefaultBookmark | |
Fields | |
Instances
| Eq DefaultBookmark Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: DefaultBookmark -> DefaultBookmark -> Bool # (/=) :: DefaultBookmark -> DefaultBookmark -> Bool # | |
| Show DefaultBookmark Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> DefaultBookmark -> ShowS # show :: DefaultBookmark -> String # showList :: [DefaultBookmark] -> ShowS # | |
Wrapper for [.Bookmark]
Constructors
| Bookmarks | |
Fields
| |
data BookmarkSearchTerm Source #
Data-type for represting a bookmark search. You can either search
by index or by name. Used by the delete and move commands.
Constructors
| SearchIndex Int | |
| SearchName Text |
Instances
| Eq BookmarkSearchTerm Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: BookmarkSearchTerm -> BookmarkSearchTerm -> Bool # (/=) :: BookmarkSearchTerm -> BookmarkSearchTerm -> Bool # | |
| Show BookmarkSearchTerm Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> BookmarkSearchTerm -> ShowS # show :: BookmarkSearchTerm -> String # showList :: [BookmarkSearchTerm] -> ShowS # | |
data ConfigValueType Source #
The types of config values allowed in the Hoyo config.
Constructors
| TBool | |
| TDefaultBookmark | |
| TCommand | |
| TList ConfigValueType | |
| TMaybe ConfigValueType |
data ConfigValue (t :: ConfigValueType) where Source #
Values in the Hoyo config. Using a GADT parameterised by ConfigValueType
gives us stricter type safety.
Constructors
| BoolV :: Bool -> ConfigValue 'TBool | |
| DefaultBookmarkV :: DefaultBookmark -> ConfigValue 'TDefaultBookmark | |
| CommandV :: Command -> ConfigValue 'TCommand | |
| ListOfV :: forall (a :: ConfigValueType). [ConfigValue a] -> ConfigValue ('TList a) | |
| MaybeV :: forall (a :: ConfigValueType). Maybe (ConfigValue a) -> ConfigValue ('TMaybe a) |
Instances
| Eq (ConfigValue t) Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigValue t -> ConfigValue t -> Bool # (/=) :: ConfigValue t -> ConfigValue t -> Bool # | |
| Show (ConfigValue t) Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigValue t -> ShowS # show :: ConfigValue t -> String # showList :: [ConfigValue t] -> ShowS # | |
data AnyConfigValue Source #
Existential wrapper around ConfigValue.
Constructors
| forall (t :: ConfigValueType). AnyConfigValue (ConfigValue t) |
A representation of hoyo settings.
Constructors
| Config | |
Fields
| |
data SearchException Source #
Report an exception while searching for a bookmark.
Constructors
| NothingFound BookmarkSearchTerm | |
| TooManyResults BookmarkSearchTerm [Text] |
Instances
data CommandException Source #
Report an exception while running a command.
Constructors
| SearchException SearchException | |
| InvalidArgumentException [Text] | |
| LoopException |
Instances
data FileSystemException Source #
Report a file system exception.
Constructors
| NoFileException FilePath | |
| NoDirException FilePath |
Instances
data HoyoException Source #
A custom hierarchical exception type for hoyo.
Constructors
| ConfigException [Text] | |
| CommandException CommandException | |
| IOException IOError | |
| FileSystemException FileSystemException | |
| ParseException [Text] | |
| MultipleExceptions (NonEmpty HoyoException) |
Instances
HoyoMonad is the main monad stack for the hoyo program. It's essentially a wrapper
around ExceptT T.Text (ReaderT Env IO): in other words,
HoyoMonad a is equivalent to Env -> IO (Either T.Text a)
Instances
| Monad HoyoMonad Source # | |
| Functor HoyoMonad Source # | |
| Applicative HoyoMonad Source # | |
| MonadIO HoyoMonad Source # | |
Defined in Hoyo.Internal.Types | |
| MonadThrow HoyoMonad Source # | |
Defined in Hoyo.Internal.Types | |
| MonadCatch HoyoMonad Source # | |
| MonadReader Env HoyoMonad Source # | |
| MonadError HoyoException HoyoMonad Source # | |
Defined in Hoyo.Internal.Types Methods throwError :: HoyoException -> HoyoMonad a # catchError :: HoyoMonad a -> (HoyoException -> HoyoMonad a) -> HoyoMonad a # | |
data AddOptions Source #
Options for the "add" command to be parsed from the command-line.
Constructors
| AddOptions | |
Fields
| |
Instances
| Eq AddOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show AddOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> AddOptions -> ShowS # show :: AddOptions -> String # showList :: [AddOptions] -> ShowS # | |
newtype MoveOptions Source #
Options for the "move" command to be parsed from the command-line.
Constructors
| MoveOptions | |
Fields | |
Instances
| Eq MoveOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show MoveOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> MoveOptions -> ShowS # show :: MoveOptions -> String # showList :: [MoveOptions] -> ShowS # | |
data ListOptions Source #
Options for the "list" command to be parsed from the command-line.
Constructors
| ListOptions | |
Fields | |
Instances
| Eq ListOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show ListOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ListOptions -> ShowS # show :: ListOptions -> String # showList :: [ListOptions] -> ShowS # | |
data ClearOptions Source #
Options for the "clear" command to be parsed from the command-line.
Constructors
| ClearOptions |
Instances
| Eq ClearOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show ClearOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ClearOptions -> ShowS # show :: ClearOptions -> String # showList :: [ClearOptions] -> ShowS # | |
newtype DeleteOptions Source #
Options for the "delete" command to be parsed from the command-line.
Constructors
| DeleteOptions | |
Fields | |
Instances
| Eq DeleteOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: DeleteOptions -> DeleteOptions -> Bool # (/=) :: DeleteOptions -> DeleteOptions -> Bool # | |
| Show DeleteOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> DeleteOptions -> ShowS # show :: DeleteOptions -> String # showList :: [DeleteOptions] -> ShowS # | |
data RefreshOptions Source #
Options for the "refresh" command to be parsed from the command-line.
Constructors
| RefreshOptions |
Instances
| Eq RefreshOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: RefreshOptions -> RefreshOptions -> Bool # (/=) :: RefreshOptions -> RefreshOptions -> Bool # | |
| Show RefreshOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> RefreshOptions -> ShowS # show :: RefreshOptions -> String # showList :: [RefreshOptions] -> ShowS # | |
newtype ConfigPrintOptions Source #
Options for the "config print" command to be parsed from the command-line.
Constructors
| ConfigPrintOptions | |
Fields | |
Instances
| Eq ConfigPrintOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigPrintOptions -> ConfigPrintOptions -> Bool # (/=) :: ConfigPrintOptions -> ConfigPrintOptions -> Bool # | |
| Show ConfigPrintOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigPrintOptions -> ShowS # show :: ConfigPrintOptions -> String # showList :: [ConfigPrintOptions] -> ShowS # | |
data ConfigResetOptions Source #
Options for the "config reset" command to be parsed from the command-line.
Constructors
| ConfigResetOptions |
Instances
| Eq ConfigResetOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigResetOptions -> ConfigResetOptions -> Bool # (/=) :: ConfigResetOptions -> ConfigResetOptions -> Bool # | |
| Show ConfigResetOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigResetOptions -> ShowS # show :: ConfigResetOptions -> String # showList :: [ConfigResetOptions] -> ShowS # | |
data ConfigSetOptions Source #
Options for the "config set" command to be parsed from the command-line.
Constructors
| ConfigSetOptions | |
Instances
| Eq ConfigSetOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigSetOptions -> ConfigSetOptions -> Bool # (/=) :: ConfigSetOptions -> ConfigSetOptions -> Bool # | |
| Show ConfigSetOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigSetOptions -> ShowS # show :: ConfigSetOptions -> String # showList :: [ConfigSetOptions] -> ShowS # | |
data ConfigAddDefaultOptions Source #
Options for the "config add-default" command to be parsed from the command-line.
Constructors
| ConfigAddDefaultOptions | |
Fields | |
Instances
| Eq ConfigAddDefaultOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigAddDefaultOptions -> ConfigAddDefaultOptions -> Bool # (/=) :: ConfigAddDefaultOptions -> ConfigAddDefaultOptions -> Bool # | |
| Show ConfigAddDefaultOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigAddDefaultOptions -> ShowS # show :: ConfigAddDefaultOptions -> String # showList :: [ConfigAddDefaultOptions] -> ShowS # | |
data ConfigCommand Source #
Options for the "config" command to be parsed from the command-line.
Constructors
| Print ConfigPrintOptions | |
| Reset ConfigResetOptions | |
| Set ConfigSetOptions | |
| AddDefaultBookmark ConfigAddDefaultOptions |
Instances
| Eq ConfigCommand Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: ConfigCommand -> ConfigCommand -> Bool # (/=) :: ConfigCommand -> ConfigCommand -> Bool # | |
| Show ConfigCommand Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> ConfigCommand -> ShowS # show :: ConfigCommand -> String # showList :: [ConfigCommand] -> ShowS # | |
data CheckOptions Source #
Options for the "check" command to be parsed from the command-line.
Constructors
| CheckOptions | |
Fields
| |
Instances
| Eq CheckOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show CheckOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> CheckOptions -> ShowS # show :: CheckOptions -> String # showList :: [CheckOptions] -> ShowS # | |
newtype HelpOptions Source #
Options for the "help" command to be parsed from the command-line.
Constructors
| HelpOptions | |
Fields | |
Instances
| Eq HelpOptions Source # | |
Defined in Hoyo.Internal.Types | |
| Show HelpOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> HelpOptions -> ShowS # show :: HelpOptions -> String # showList :: [HelpOptions] -> ShowS # | |
The core data-type for the hoyo CLI. The Command is parsed from the command-line,
then runCommand dispatches on the type.
data MaybeOverride Source #
Datatype for representing a command-line settings override.
Constructors
| OverrideFalse | |
| OverrideTrue | |
| NoOverride | |
| Conflict |
Instances
| Eq MaybeOverride Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: MaybeOverride -> MaybeOverride -> Bool # (/=) :: MaybeOverride -> MaybeOverride -> Bool # | |
| Show MaybeOverride Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> MaybeOverride -> ShowS # show :: MaybeOverride -> String # showList :: [MaybeOverride] -> ShowS # | |
data OverrideOptions Source #
Config settings that can be overriden using command-line flags.
Constructors
| OverrideOptions | |
Instances
| Eq OverrideOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: OverrideOptions -> OverrideOptions -> Bool # (/=) :: OverrideOptions -> OverrideOptions -> Bool # | |
| Show OverrideOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> OverrideOptions -> ShowS # show :: OverrideOptions -> String # showList :: [OverrideOptions] -> ShowS # | |
data GlobalOptions Source #
CLI options that can be set regardless of which command is run.
Constructors
| GlobalOptions | |
Fields | |
Instances
| Eq GlobalOptions Source # | |
Defined in Hoyo.Internal.Types Methods (==) :: GlobalOptions -> GlobalOptions -> Bool # (/=) :: GlobalOptions -> GlobalOptions -> Bool # | |
| Show GlobalOptions Source # | |
Defined in Hoyo.Internal.Types Methods showsPrec :: Int -> GlobalOptions -> ShowS # show :: GlobalOptions -> String # showList :: [GlobalOptions] -> ShowS # | |
The final result of parsing the CLI arguments. Contains a command and all information for that command, and any global options that have been set.
Constructors
| Options | |
Fields | |