shortcut-links-0.5.1.0: Link shortcuts for use in text markup

Copyright(c) 2015-2019 Aelve
(c) 2019-2020 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
Safe HaskellSafe
LanguageHaskell2010

ShortcutLinks

Description

 
Synopsis

Documentation

data Result a Source #

Resulting data type over the work of shortcut-links

Constructors

Failure String 
Warning [String] a 
Success a 
Instances
Monad Result Source # 
Instance details

Defined in ShortcutLinks.All

Methods

(>>=) :: Result a -> (a -> Result b) -> Result b #

(>>) :: Result a -> Result b -> Result b #

return :: a -> Result a #

fail :: String -> Result a #

Functor Result Source # 
Instance details

Defined in ShortcutLinks.All

Methods

fmap :: (a -> b) -> Result a -> Result b #

(<$) :: a -> Result b -> Result a #

MonadFail Result Source # 
Instance details

Defined in ShortcutLinks.All

Methods

fail :: String -> Result a #

Applicative Result Source # 
Instance details

Defined in ShortcutLinks.All

Methods

pure :: a -> Result a #

(<*>) :: Result (a -> b) -> Result a -> Result b #

liftA2 :: (a -> b -> c) -> Result a -> Result b -> Result c #

(*>) :: Result a -> Result b -> Result b #

(<*) :: Result a -> Result b -> Result a #

Show a => Show (Result a) Source # 
Instance details

Defined in ShortcutLinks.All

Methods

showsPrec :: Int -> Result a -> ShowS #

show :: Result a -> String #

showList :: [Result a] -> ShowS #

type Shortcut = Maybe Text -> Text -> Result Text Source #

Type alias for shortcut links Result functions.

allShortcuts :: [([Text], Shortcut)] Source #

A list of all functions included in this module, together with suggested names for them.

useShortcut Source #

Arguments

:: Text

Shortcut name

-> Maybe Text

Option

-> Text

Link text

-> Result Text

Resulting URL

Use a shortcut from allShortcuts.

This is the main function you should use.

useShortcutFrom Source #

Arguments

:: [([Text], Shortcut)] 
-> Text

Shortcut name

-> Maybe Text

Option

-> Text

Link text

-> Result Text

Resulting URL

Use a shortcut from a list.

For instance, if you want to add hk as a synonym for hackage, you'd write:

>>> useShortcutFrom ((["hk"], hackage) : allShortcuts)