Make cons right-associative.
Requested by Ivan Miljenovic.
commit5f5e477e0304cf4d6a6c526d1956c6fdf39562ea
authorBryan O'Sullivan <bos@serpentine.com>
dateFri 28 Jan 2011, 16:15 (16 years ago)
parent1182ba1
Data/Text.hs+2
@@ -388,6 +388,8 @@ cons :: Char -> Text -> Text
388388cons c t = unstream (S.cons (safe c) (stream t))
389389{-# INLINE cons #-}
390390
391+infixr 5 cons
392+
391393-- | /O(n)/ Adds a character to the end of a 'Text'. This copies the
392394-- entire array in the process, unless fused. Subject to fusion.
393395-- Performs replacement on invalid scalar values.
Data/Text/Lazy.hs+2
@@ -392,6 +392,8 @@ cons :: Char -> Text -> Text
392392cons c t = Chunk (T.singleton c) t
393393{-# INLINE [1] cons #-}
394394
395+infixr 5 cons
396+
395397{-# RULES
396398"LAZY TEXT cons -> fused" [~1] forall c t.
397399 cons c t = unstream (S.cons c (stream t))