From 5dfb19cd29e1a698a777239788ecfedb188adaa8 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Thu, 15 Mar 2018 12:29:46 -0700 Subject: [PATCH] Docs, function ordering --- src/Data/Abstract/FreeVariables.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data/Abstract/FreeVariables.hs b/src/Data/Abstract/FreeVariables.hs index 19d319cd5..f96270244 100644 --- a/src/Data/Abstract/FreeVariables.hs +++ b/src/Data/Abstract/FreeVariables.hs @@ -20,16 +20,16 @@ name x = x :| [] qualifiedName :: [ByteString] -> Name 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. splitOnPathSeparator :: ByteString -> [ByteString] splitOnPathSeparator = BC.split '/' . BC.dropWhile (== '/') . BC.dropWhile (== '.') . stripQuotes where stripQuotes = B.filter (/= fromIntegral (ord '\"')) --- | Construct a qualified 'Name' from a `/` delimited path. -pathToQualifiedName :: ByteString -> Name -pathToQualifiedName = qualifiedName . splitOnPathSeparator - --- | User friendly version of a qualified 'Name'. +-- | User friendly 'ByteString' of a qualified 'Name'. friendlyName :: Name -> ByteString friendlyName xs = intercalate "." (NonEmpty.toList xs)