Commits

Bryan O'Sullivan committed d8f1dee

Fix infinite loop on unstream of empty stream

Various stream properties were getting stuck on this, e.g. T.concat [T.empty]

Comments (0)

Files changed (2)

 
 -- | /O(n)/ Convert a Stream Char into a Text.
 unstream :: Stream Char -> Text
+unstream (Stream _next0 _s0 0) = empty
 unstream (Stream next0 s0 len) = Text (fst a) 0 (snd a)
     where
       a = runST (A.unsafeNew len >>= (\arr -> loop arr 0 len s0))
   ("prop_cons", mytest prop_cons),
   ("prop_snoc", mytest prop_snoc),
   ("prop_append", mytest prop_append),
---("prop_appendS", mytest prop_appendS),
+  ("prop_appendS", mytest prop_appendS),
   ("prop_head", mytest prop_head),
   ("prop_last", mytest prop_last),
   ("prop_lastS", mytest prop_lastS),
   ("prop_tail", mytest prop_tail),
---("prop_tailS", mytest prop_tailS),
+  ("prop_tailS", mytest prop_tailS),
   ("prop_init", mytest prop_init),
---("prop_initS", mytest prop_initS),
+  ("prop_initS", mytest prop_initS),
   ("prop_null", mytest prop_null),
   ("prop_length", mytest prop_length),
   ("prop_map", mytest prop_map),
   ("prop_foldr", mytest prop_foldr),
   ("prop_foldr1", mytest prop_foldr1),
 
---("prop_concat", mytest prop_concat),
---("prop_concatMap", mytest prop_concatMap),
+  ("prop_concat", mytest prop_concat),
+  ("prop_concatMap", mytest prop_concatMap),
   ("prop_any", mytest prop_any),
   ("prop_all", mytest prop_all),
   ("prop_minimum", mytest prop_minimum),
   ("prop_index", mytest prop_index),
   ("prop_findIndex", mytest prop_findIndex),
   ("prop_elemIndex", mytest prop_elemIndex),
---("prop_zipWith", mytest prop_zipWith),
+  ("prop_zipWith", mytest prop_zipWith),
   ("prop_words", mytest prop_words)
   ]