Commit 087277b8 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Rewrite singletonS

parent 185f40d6
......@@ -32,11 +32,11 @@ emptyS = Stream (const Done) () 0
--
singletonS :: a -> Stream a
{-# INLINE [1] singletonS #-}
singletonS x = Stream next (JustS (Box x)) 1
singletonS x = Stream next True 1
where
{-# INLINE next #-}
next (JustS (Box x)) = Yield x NothingS
next NothingS = Done
next True = Yield x False
next False = Done
-- | Construction
--
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment