learning-hmm-0.1.0.0: src/Data/Vector/Util.hs
-- | Miscellaneous utility functions for "Data.Vector"
module Data.Vector.Util (
unsafeElemIndex
) where
import Data.Maybe (fromJust)
import Data.Vector (Vector, elemIndex)
-- | Return the index of the first occurrence of the given element or throw
-- an error if no such occurrence.
{-# INLINE unsafeElemIndex #-}
unsafeElemIndex :: Eq a => a -> Vector a -> Int
unsafeElemIndex e = fromJust . elemIndex e