{-# LANGUAGE DeriveDataTypeable , GeneralizedNewtypeDeriving , StandaloneDeriving , UnicodeSyntax #-} module Data.URI.Internal.Scheme ( Scheme , unsafeCreateScheme ) where import Data.Ascii (CIAscii) import Data.CaseInsensitive import Data.Hashable import Data.String import Data.Typeable -- |'Scheme' names consist of a non-empty sequence of characters -- beginning with a letter and followed by any combination of letters, -- digits, plus (\'+\'), period (\'.\'), or hyphen (\'-\'): -- newtype Scheme = Scheme CIAscii deriving ( Eq , FoldCase , Hashable , Ord , Show , Typeable ) -- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) -- |'isString' is a fast but unsafe way to create 'Scheme' such that -- no validation on the string is performed. deriving instance IsString Scheme -- |Converts a 'CIAscii' to 'Scheme' without any validation on the -- string. unsafeCreateScheme ∷ CIAscii → Scheme {-# INLINE CONLIKE unsafeCreateScheme #-} unsafeCreateScheme = Scheme