We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b984150 + c4411ff commit babf096Copy full SHA for babf096
1 file changed
src/Data/NonEmptyText.hs
@@ -37,6 +37,9 @@ data NonEmptyText =
37
NonEmptyText Char Text.Text
38
deriving (Eq, Ord, NFData, Generic)
39
40
+-- |
41
+-- Note that this instance uses 'toText', so two unequal NonEmptyTexts might be
42
+-- unequal even though they 'show' the same
43
instance Show NonEmptyText where
44
show = show . toText
45
@@ -140,6 +143,8 @@ length = (1 +) . Text.length . Data.NonEmptyText.tail
140
143
--
141
144
-- The 'Data.Text.Text' result is guaranteed to be non-empty. However, this is
142
145
-- not reflected in the type.
146
+-- Note that the first 'Char' may be replaced with U+FFFD,
147
+-- which happens when 'Data.Text.cons' would also replace it.
148
toText :: NonEmptyText -> Text.Text
149
toText = uncurry Text.cons . uncons
150
0 commit comments