mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +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'.
|
-- | Extract an association list of bindings from an 'Environment'.
|
||||||
--
|
--
|
||||||
-- >>> pairs shadowed
|
-- >>> pairs shadowed
|
||||||
-- [(Name {unName = "foo"},Address {unAddress = Precise 1)]
|
-- [(Name "foo",Address {unAddress = Precise 1)]
|
||||||
pairs :: Environment location value -> [(Name, Address location value)]
|
pairs :: Environment location value -> [(Name, Address location value)]
|
||||||
pairs = map (second Address) . Map.toList . fold . unEnvironment
|
pairs = map (second Address) . Map.toList . fold . unEnvironment
|
||||||
|
|
||||||
|
@ -8,12 +8,15 @@ import Data.Term
|
|||||||
import Prologue
|
import Prologue
|
||||||
|
|
||||||
-- | The type of variable names.
|
-- | The type of variable names.
|
||||||
newtype Name = Name { unName :: ByteString }
|
newtype Name = Name ByteString
|
||||||
deriving (Eq, Ord, Show)
|
deriving (Eq, Ord, Show)
|
||||||
|
|
||||||
name :: ByteString -> Name
|
name :: ByteString -> Name
|
||||||
name = Name
|
name = Name
|
||||||
|
|
||||||
|
unName :: Name -> ByteString
|
||||||
|
unName (Name bytes) = bytes
|
||||||
|
|
||||||
instance IsString Name where
|
instance IsString Name where
|
||||||
fromString = Name . BC.pack
|
fromString = Name . BC.pack
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user