module Hakyll.Shortcode.Types.RFC_3986_Unreserved_Uri_Characters (
RFC_3986_Unreserved_Uri_Characters()
) where
import Text.Regex.Posix ((=~))
import Hakyll.Shortcode.Validate
newtype RFC_3986_Unreserved_Uri_Characters
= Make { unMake :: String } deriving Eq
instance Validate RFC_3986_Unreserved_Uri_Characters where
validate text = case text =~ "^[-a-zA-Z0-9_\\.~]+$" of
True -> Right $ Make text
False -> Left "Must be one or more of a-z, A-Z, 0-9, -, ., _, or ~."
instance Show RFC_3986_Unreserved_Uri_Characters where
show = unMake