Skip to content

Commit 9c578f6

Browse files
Language.Nix.Identifier: classify exposed symbols
- In general, one should Identifier and its instances to render and parse Identifiers. quote has been relegated to an Internals section since it is only required by the test suite at the moment. It may be nice to remove it at some point. - needsQuoting deals with arbitrary strings and would normally be used to judge whether a given String should be converted to an Identifier directly or first be subject to some kind of substitution so that it does not need to be quoted (see #672). nixKeywords is an internal definition involved with this which is also used in the test suites.
1 parent b8b9c2e commit 9c578f6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

language-nix/src/Language/Nix/Identifier.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
{-# LANGUAGE TemplateHaskell #-}
55

66
module Language.Nix.Identifier
7-
( Identifier, ident, quote, needsQuoting, nixKeywords
7+
( -- * Type-safe Identifiers
8+
Identifier, ident
89
, parseSimpleIdentifier, parseQuotedIdentifier
9-
-- TODO: why do we expose quote?
10+
-- * String Predicates
11+
, needsQuoting
12+
-- * Internals
13+
-- TODO: only required by the language-nix test suite, unexport?
14+
, nixKeywords
15+
, quote
1016
)
1117
where
1218

@@ -130,6 +136,7 @@ nixKeywords =
130136
[ "assert", "with", "if", "then", "else", "let", "in", "rec", "inherit", "or" ]
131137

132138
-- | Helper function to quote a given identifier string if necessary.
139+
-- Usually, one should use the 'Pretty' instance of 'Identifier' instead.
133140
--
134141
-- >>> putStrLn (quote "abc")
135142
-- abc

0 commit comments

Comments
 (0)