File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
uuid-types/Data/UUID/Types Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ import Data.Data
5656import Data.Functor ((<$>) )
5757import Data.Hashable
5858import Data.List (elemIndices )
59+ import Data.Maybe (fromMaybe )
60+ import Data.Semigroup ((<>) )
61+ import qualified Data.String as S (IsString (.. ))
5962import Foreign.Ptr (Ptr )
6063
6164import Foreign.Storable
@@ -79,6 +82,10 @@ import System.Random
7982-- <http://tools.ietf.org/html/rfc4122 RFC 4122>.
8083data UUID = UUID {- # UNPACK #-} !Word64 {- # UNPACK #-} !Word64
8184 deriving (Eq , Ord , Typeable )
85+
86+ instance S. IsString UUID where
87+ fromString str = fromMaybe (error (" '" <> str <> " ' is not a valid UUID" )) $ fromString str
88+
8289{-
8390 Prior to uuid-types-1.0.4:
8491 !Word32 !Word32 !Word32 !Word32
You can’t perform that action at this time.
0 commit comments