mirror of
https://github.com/github/semantic.git
synced 2024-12-20 05:11:44 +03:00
Docs, function ordering
This commit is contained in:
parent
92b383cf45
commit
5dfb19cd29
@ -20,16 +20,16 @@ name x = x :| []
|
|||||||
qualifiedName :: [ByteString] -> Name
|
qualifiedName :: [ByteString] -> Name
|
||||||
qualifiedName = NonEmpty.fromList
|
qualifiedName = NonEmpty.fromList
|
||||||
|
|
||||||
|
-- | Construct a qualified 'Name' from a `/` delimited path.
|
||||||
|
pathToQualifiedName :: ByteString -> Name
|
||||||
|
pathToQualifiedName = qualifiedName . splitOnPathSeparator
|
||||||
|
|
||||||
-- | Split a 'ByteString' path on `/`, stripping quotes and any `./` prefix.
|
-- | Split a 'ByteString' path on `/`, stripping quotes and any `./` prefix.
|
||||||
splitOnPathSeparator :: ByteString -> [ByteString]
|
splitOnPathSeparator :: ByteString -> [ByteString]
|
||||||
splitOnPathSeparator = BC.split '/' . BC.dropWhile (== '/') . BC.dropWhile (== '.') . stripQuotes
|
splitOnPathSeparator = BC.split '/' . BC.dropWhile (== '/') . BC.dropWhile (== '.') . stripQuotes
|
||||||
where stripQuotes = B.filter (/= fromIntegral (ord '\"'))
|
where stripQuotes = B.filter (/= fromIntegral (ord '\"'))
|
||||||
|
|
||||||
-- | Construct a qualified 'Name' from a `/` delimited path.
|
-- | User friendly 'ByteString' of a qualified 'Name'.
|
||||||
pathToQualifiedName :: ByteString -> Name
|
|
||||||
pathToQualifiedName = qualifiedName . splitOnPathSeparator
|
|
||||||
|
|
||||||
-- | User friendly version of a qualified 'Name'.
|
|
||||||
friendlyName :: Name -> ByteString
|
friendlyName :: Name -> ByteString
|
||||||
friendlyName xs = intercalate "." (NonEmpty.toList xs)
|
friendlyName xs = intercalate "." (NonEmpty.toList xs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user