    -- |
    -- Module:      Math.NumberTheory.Zeta.Utils
    -- Copyright:   (c) 2018 Alexandre Rodrigues Baldé
    -- Licence:     MIT
    -- Maintainer:  Alexandre Rodrigues Baldé <alexandrer_b@outlook.com>
    --
    -- Shared utilities used by functions from @Math.NumberTheory.Zeta@.

    module Math.NumberTheory.Zeta.Utils
      ( skipEvens
      , skipOdds
      ) where

    import Data.List.Infinite (Infinite(..))
    import qualified Data.List.Infinite as Inf

    -- | Skips every odd-indexed element from an infinite list.
    -- Do NOT use with finite lists.
    --
    -- >>> take 10 (skipOdds [0, 1 ..])
    -- [0,2,4,6,8,10,12,14,16,18]
    skipOdds :: Infinite a -> Infinite a
    skipOdds :: forall a. Infinite a -> Infinite a
    skipOdds (a
    x :< a
    _ :< Infinite a
    xs) = a
    x a -> Infinite a -> Infinite a
    forall a. a -> Infinite a -> Infinite a
    :< Infinite a -> Infinite a
    forall a. Infinite a -> Infinite a
    skipOdds Infinite a
    xs

    -- | Skips every even-indexed element from an infinite list.
    -- Do NOT use with finite lists.
    --
    -- >>> take 10 (skipEvens [0, 1 ..])
    -- [1,3,5,7,9,11,13,15,17,19]
    skipEvens :: Infinite a -> Infinite a
    skipEvens :: forall a. Infinite a -> Infinite a
    skipEvens = Infinite a -> Infinite a
    forall a. Infinite a -> Infinite a
    skipOdds (Infinite a -> Infinite a)
    -> (Infinite a -> Infinite a) -> Infinite a -> Infinite a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Infinite a -> Infinite a
    forall a. Infinite a -> Infinite a
    Inf.tail