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

module Torch.Cast where

import Foreign.ForeignPtr
import Torch.Internal.Cast
import Torch.Internal.Class
import Torch.Internal.Managed.Type.IntArray
import Torch.Internal.Type

-- define useful casts

instance CppTuple2 (ForeignPtr IntArray) where
  type A (ForeignPtr IntArray) = Int
  type B (ForeignPtr IntArray) = Int
  get0 :: ForeignPtr IntArray -> IO (A (ForeignPtr IntArray))
get0 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
0)
  get1 :: ForeignPtr IntArray -> IO (B (ForeignPtr IntArray))
get1 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
1)

instance CppTuple3 (ForeignPtr IntArray) where
  type C (ForeignPtr IntArray) = Int
  get2 :: ForeignPtr IntArray -> IO (C (ForeignPtr IntArray))
get2 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
2)

instance CppTuple4 (ForeignPtr IntArray) where
  type D (ForeignPtr IntArray) = Int
  get3 :: ForeignPtr IntArray -> IO (D (ForeignPtr IntArray))
get3 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
3)

instance CppTuple5 (ForeignPtr IntArray) where
  type E (ForeignPtr IntArray) = Int
  get4 :: ForeignPtr IntArray -> IO (E (ForeignPtr IntArray))
get4 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
4)

instance CppTuple6 (ForeignPtr IntArray) where
  type F (ForeignPtr IntArray) = Int
  get5 :: ForeignPtr IntArray -> IO (F (ForeignPtr IntArray))
get5 = forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 (ForeignPtr IntArray -> CSize -> IO Int64
`intArray_at_s` CSize
5)