1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Define a helper to extract the User name from a Named value.

This commit is contained in:
Rob Rix 2019-07-02 12:07:28 -04:00
parent 906eba62f0
commit daa280c300
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -4,6 +4,7 @@ module Data.Name
, Namespaced
, Name(..)
, Named(..)
, namedName
, reservedNames
, isSimpleCharacter
, needsQuotation
@ -73,6 +74,9 @@ data Named a = Named User a
instance Eq a => Eq (Named a) where (==) = (==) `on` namedValue
instance Ord a => Ord (Named a) where compare = compare `on` namedValue
namedName :: Named a -> User
namedName (Named n _) = n
namedValue :: Named a -> a
namedValue (Named _ a) = a