module Numeric.Natural.Prelude where

import Numeric.Natural
import Prelude hiding (length)
import qualified Prelude as P
import qualified Safe as P
import qualified Control.Monad as P
import qualified Data.List as P
import Control.Applicative ((<$>))

length :: [a] -> Natural
length = fromIntegral . P.length

elemIndex :: Eq a => a -> [a] -> Maybe Natural
elemIndex = ((fromIntegral <$>) .) . P.elemIndex

replicateM :: Monad m => Natural -> m a -> m [a]
replicateM = P.replicateM . fromIntegral

at :: [a] -> Natural -> a
at = (. fromIntegral) . (!!)

atMay :: [a] -> Natural -> Maybe a
atMay = (. fromIntegral) . P.atMay
