Commits

Bryan O'Sullivan committed 3ee4a41

Reduce inlining bloat from use of single-element literals

Comments (0)

Files changed (2)

     unstream (S.map safe (S.streamList []))
       = empty_ #-}
 
+{-# RULES "TEXT singleton literal" forall a.
+    unstream (S.map safe (S.streamList [a]))
+      = singleton_ a #-}
+
 -- | /O(1)/ Convert a character into a Text.  Subject to fusion.
 -- Performs replacement on invalid scalar values.
 singleton :: Char -> Text

Data/Text/Lazy.hs

     unstream (S.streamList (L.map safe []))
       = Empty #-}
 
+{-# RULES "LAZY TEXT empty literal" forall a.
+    unstream (S.streamList (L.map safe [a]))
+      = Chunk (T.singleton a) Empty #-}
+
 -- | /O(1)/ Convert a character into a Text.  Subject to fusion.
 -- Performs replacement on invalid scalar values.
 singleton :: Char -> Text