{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies          #-}

module HaskellWorks.Data.Drop
    ( Container(..)
    , Drop(..)
    ) where

import Data.Int
import Data.Word
import HaskellWorks.Data.Container
import HaskellWorks.Data.Positioning
import Prelude                       hiding (drop)

import qualified Data.ByteString      as BS
import qualified Data.List            as L
import qualified Data.Vector          as DV
import qualified Data.Vector.Storable as DVS

class Container v => Drop v where
  drop :: Count -> v -> v

instance Drop [a] where
  drop :: Count -> [a] -> [a]
drop = Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
L.drop (Int -> [a] -> [a]) -> (Count -> Int) -> Count -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop BS.ByteString where
  drop :: Count -> ByteString -> ByteString
drop = Int -> ByteString -> ByteString
BS.drop (Int -> ByteString -> ByteString)
-> (Count -> Int) -> Count -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Word8) where
  drop :: Count -> Vector Word8 -> Vector Word8
drop = Int -> Vector Word8 -> Vector Word8
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Word8 -> Vector Word8)
-> (Count -> Int) -> Count -> Vector Word8 -> Vector Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Word16) where
  drop :: Count -> Vector Word16 -> Vector Word16
drop = Int -> Vector Word16 -> Vector Word16
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Word16 -> Vector Word16)
-> (Count -> Int) -> Count -> Vector Word16 -> Vector Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Word32) where
  drop :: Count -> Vector Word32 -> Vector Word32
drop = Int -> Vector Word32 -> Vector Word32
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Word32 -> Vector Word32)
-> (Count -> Int) -> Count -> Vector Word32 -> Vector Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Word64) where
  drop :: Count -> Vector Count -> Vector Count
drop = Int -> Vector Count -> Vector Count
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Count -> Vector Count)
-> (Count -> Int) -> Count -> Vector Count -> Vector Count
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Word8) where
  drop :: Count -> Vector Word8 -> Vector Word8
drop = Int -> Vector Word8 -> Vector Word8
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Word8 -> Vector Word8)
-> (Count -> Int) -> Count -> Vector Word8 -> Vector Word8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Word16) where
  drop :: Count -> Vector Word16 -> Vector Word16
drop = Int -> Vector Word16 -> Vector Word16
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Word16 -> Vector Word16)
-> (Count -> Int) -> Count -> Vector Word16 -> Vector Word16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Word32) where
  drop :: Count -> Vector Word32 -> Vector Word32
drop = Int -> Vector Word32 -> Vector Word32
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Word32 -> Vector Word32)
-> (Count -> Int) -> Count -> Vector Word32 -> Vector Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Word64) where
  drop :: Count -> Vector Count -> Vector Count
drop = Int -> Vector Count -> Vector Count
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Count -> Vector Count)
-> (Count -> Int) -> Count -> Vector Count -> Vector Count
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Int8) where
  drop :: Count -> Vector Int8 -> Vector Int8
drop = Int -> Vector Int8 -> Vector Int8
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Int8 -> Vector Int8)
-> (Count -> Int) -> Count -> Vector Int8 -> Vector Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Int16) where
  drop :: Count -> Vector Int16 -> Vector Int16
drop = Int -> Vector Int16 -> Vector Int16
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Int16 -> Vector Int16)
-> (Count -> Int) -> Count -> Vector Int16 -> Vector Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Int32) where
  drop :: Count -> Vector Int32 -> Vector Int32
drop = Int -> Vector Int32 -> Vector Int32
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Int32 -> Vector Int32)
-> (Count -> Int) -> Count -> Vector Int32 -> Vector Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DV.Vector Int64) where
  drop :: Count -> Vector Int64 -> Vector Int64
drop = Int -> Vector Int64 -> Vector Int64
forall a. Int -> Vector a -> Vector a
DV.drop (Int -> Vector Int64 -> Vector Int64)
-> (Count -> Int) -> Count -> Vector Int64 -> Vector Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Int8) where
  drop :: Count -> Vector Int8 -> Vector Int8
drop = Int -> Vector Int8 -> Vector Int8
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Int8 -> Vector Int8)
-> (Count -> Int) -> Count -> Vector Int8 -> Vector Int8
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Int16) where
  drop :: Count -> Vector Int16 -> Vector Int16
drop = Int -> Vector Int16 -> Vector Int16
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Int16 -> Vector Int16)
-> (Count -> Int) -> Count -> Vector Int16 -> Vector Int16
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Int32) where
  drop :: Count -> Vector Int32 -> Vector Int32
drop = Int -> Vector Int32 -> Vector Int32
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Int32 -> Vector Int32)
-> (Count -> Int) -> Count -> Vector Int32 -> Vector Int32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Int64) where
  drop :: Count -> Vector Int64 -> Vector Int64
drop = Int -> Vector Int64 -> Vector Int64
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Int64 -> Vector Int64)
-> (Count -> Int) -> Count -> Vector Int64 -> Vector Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}

instance Drop (DVS.Vector Int) where
  drop :: Count -> Vector Int -> Vector Int
drop = Int -> Vector Int -> Vector Int
forall a. Storable a => Int -> Vector a -> Vector a
DVS.drop (Int -> Vector Int -> Vector Int)
-> (Count -> Int) -> Count -> Vector Int -> Vector Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Count -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  {-# INLINE drop #-}