reverseInits :: [a] -> [[a]]
reverseInits xs = unfoldr f ([], xs)
  where
    f :: ([a], [a]) -> Maybe ([a], ([a],[a]))
    f (_,  [])   = Nothing
    f (ys, x:xs) = 
      let ys' = x:ys
      in Just (ys', (ys',xs))

-- only works if second argument is infinite
reverseInits :: [a] -> [[a]]
reverseInits xs = unfoldr f ([], xs)
  where
    f :: ([a], [a]) -> Maybe ([a], ([a],[a]))
    f (_,  [])   = Nothing
    f (ys, x:xs) = 
      let ys' = x:ys
      in Just (ys', (ys',xs))

-- only works if second argument is infinite
reverseInits xs = unfoldr f ([], xs)
  where
    f :: ([a], [a]) -> Maybe ([a], ([a],[a]))
    f (_,  [])   = Nothing
    f (ys, x:xs) = 
      let ys' = x:ys
      in Just (ys', (ys',xs))

-- only works if second argument is infinite