-- | @until n s0 s1@ means that @eventually n s1@, and up until at least the
-- period before @s1@ holds, @s0@ continuously holds.
until :: ( Integral a ) => a -> Stream Bool -> Stream Bool -> Stream Bool
until n s0 s1 = foldl1 (||) v0
    where n' = fromIntegral n
          v0 = [ always ( i :: Int ) s0 && drop ( i + 1 ) s1
               | i <- [ 0 .. n' - 1 ]
               ]


-- | @release n s0 s1@ means that either @always n s1@, or @s1@ holds up to and
-- including the period at which @s0@ becomes true.
until :: ( Integral a ) => a -> Stream Bool -> Stream Bool -> Stream Bool
until n s0 s1 = foldl1 (||) v0
    where n' = fromIntegral n
          v0 = [ always ( i :: Int ) s0 && drop ( i + 1 ) s1
               | i <- [ 0 .. n' - 1 ]
               ]


-- | @release n s0 s1@ means that either @always n s1@, or @s1@ holds up to and
-- including the period at which @s0@ becomes true.
until n s0 s1 = foldl1 (||) v0
    where n' = fromIntegral n
          v0 = [ always ( i :: Int ) s0 && drop ( i + 1 ) s1
               | i <- [ 0 .. n' - 1 ]
               ]


-- | @release n s0 s1@ means that either @always n s1@, or @s1@ holds up to and
-- including the period at which @s0@ becomes true.