We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c6b026 commit d86cae2Copy full SHA for d86cae2
1 file changed
src/Data/Text.hs
@@ -634,7 +634,7 @@ infixl 5 :>
634
-- | /O(1)/ Tests whether a 'Text' contains exactly one character.
635
isSingleton :: Text -> Bool
636
isSingleton (Text arr off len) =
637
- len == utf8LengthByLeader (A.unsafeIndex arr off)
+ len /= 0 && len == utf8LengthByLeader (A.unsafeIndex arr off)
638
{-# INLINE isSingleton #-}
639
640
-- | /O(n)/ Returns the number of characters in a 'Text'.
0 commit comments