mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Define unName as a function rather than a field selector.
This commit is contained in:
parent
d1c465ab14
commit
2eb78e8f91
@ -85,7 +85,7 @@ mergeNewer (Environment a) (Environment b) =
|
||||
-- | Extract an association list of bindings from an 'Environment'.
|
||||
--
|
||||
-- >>> pairs shadowed
|
||||
-- [(Name {unName = "foo"},Address {unAddress = Precise 1)]
|
||||
-- [(Name "foo",Address {unAddress = Precise 1)]
|
||||
pairs :: Environment location value -> [(Name, Address location value)]
|
||||
pairs = map (second Address) . Map.toList . fold . unEnvironment
|
||||
|
||||
|
@ -8,12 +8,15 @@ import Data.Term
|
||||
import Prologue
|
||||
|
||||
-- | The type of variable names.
|
||||
newtype Name = Name { unName :: ByteString }
|
||||
newtype Name = Name ByteString
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
name :: ByteString -> Name
|
||||
name = Name
|
||||
|
||||
unName :: Name -> ByteString
|
||||
unName (Name bytes) = bytes
|
||||
|
||||
instance IsString Name where
|
||||
fromString = Name . BC.pack
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user