From: PHO Date: Thu, 12 Jan 2012 16:39:57 +0000 (+0900) Subject: Data.URI.Scheme X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=898b208;p=Lucu.git Data.URI.Scheme Ditz-issue: c80e79a2585ac20cc5ed677d70b6983a2842a81d --- diff --git a/Data/URI.hs b/Data/URI.hs new file mode 100644 index 0000000..11618bd --- /dev/null +++ b/Data/URI.hs @@ -0,0 +1,7 @@ +-- |FIXME +module Data.URI + ( Scheme + , unsafeCreateScheme + ) + where +import Data.URI.Internal.Scheme diff --git a/Data/URI/Internal/Scheme.hs b/Data/URI/Internal/Scheme.hs new file mode 100644 index 0000000..d77fdb5 --- /dev/null +++ b/Data/URI/Internal/Scheme.hs @@ -0,0 +1,40 @@ +{-# 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 diff --git a/Lucu.cabal b/Lucu.cabal index 6cbb16a..cff6ae8 100644 --- a/Lucu.cabal +++ b/Lucu.cabal @@ -69,6 +69,7 @@ Library data-default == 0.3.*, directory == 1.1.*, filepath == 1.2.*, + hashable == 1.1.*, mtl == 2.0.*, network == 2.3.*, old-time == 1.0.*, @@ -89,6 +90,7 @@ Library -DHAVE_SSL Exposed-Modules: + Data.URI Data.Collections.Newtype.TH Network.HTTP.Lucu Network.HTTP.Lucu.Abortion @@ -120,6 +122,7 @@ Library Network.HTTP.Lucu.Utils Other-Modules: + Data.URI.Internal.Scheme Network.HTTP.Lucu.Abortion.Internal Network.HTTP.Lucu.Chunk Network.HTTP.Lucu.ContentCoding