{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}



-----------------------------------------------------------------------------
-- |
-- Module      : ATen.Cast from FFICXX.Runtime.Cast
-- Copyright   : (c) 2011-2017 Ian-Woo Kim
--
-- License     : BSD3
-- Maintainer  : Junji Hashimoto<junji.hashimoto@gmail.com>
-- Stability   : experimental
-- Portability : GHC
--
-----------------------------------------------------------------------------

module Torch.Internal.Cast where

import Control.Monad         ((>=>))
import Data.ByteString.Char8 (ByteString,packCString, useAsCString)
import Data.String
import Data.Word
import Data.Int
import Foreign.C
import Foreign.C.String
import Foreign.ForeignPtr
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import Torch.Internal.Class
import Torch.Internal.GC

instance Castable a a where
  cast :: forall r. a -> (a -> IO r) -> IO r
cast a
x a -> IO r
f = a -> IO r
f a
x
  {-# INLINE cast #-}
  uncast :: forall r. a -> (a -> IO r) -> IO r
uncast a
x a -> IO r
f = a -> IO r
f a
x
  {-# INLINE uncast #-}

instance Castable Bool CBool where
  cast :: forall r. Bool -> (CBool -> IO r) -> IO r
cast Bool
x CBool -> IO r
f = CBool -> IO r
f (if Bool
x then CBool
1 else CBool
0)
  {-# INLINE cast #-}
  uncast :: forall r. CBool -> (Bool -> IO r) -> IO r
uncast CBool
x Bool -> IO r
f = Bool -> IO r
f (CBool
x forall a. Eq a => a -> a -> Bool
/= CBool
0)
  {-# INLINE uncast #-}

instance Castable Int CInt where
  cast :: forall r. Int -> (CInt -> IO r) -> IO r
cast Int
x CInt -> IO r
f = CInt -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x)
  {-# INLINE cast #-}
  uncast :: forall r. CInt -> (Int -> IO r) -> IO r
uncast CInt
x Int -> IO r
f = Int -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x)
  {-# INLINE uncast#-}

instance Castable Int Int64 where
  cast :: forall r. Int -> (Int64 -> IO r) -> IO r
cast Int
x Int64 -> IO r
f = Int64 -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x)
  {-# INLINE cast #-}
  -- TODO: Int64 might have a wider range than Int
  uncast :: forall r. Int64 -> (Int -> IO r) -> IO r
uncast Int64
x Int -> IO r
f = Int -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int64
x)
  {-# INLINE uncast #-}

instance Castable Int16 CShort where
  cast :: forall r. Int16 -> (CShort -> IO r) -> IO r
cast Int16
x CShort -> IO r
f = CShort -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int16
x)
  {-# INLINE cast #-}
  uncast :: forall r. CShort -> (Int16 -> IO r) -> IO r
uncast CShort
x Int16 -> IO r
f = Int16 -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral CShort
x)
  {-# INLINE uncast #-}

instance Castable Int8 CChar where
  cast :: forall r. Int8 -> (CChar -> IO r) -> IO r
cast Int8
x CChar -> IO r
f = CChar -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int8
x)
  {-# INLINE cast #-}
  uncast :: forall r. CChar -> (Int8 -> IO r) -> IO r
uncast CChar
x Int8 -> IO r
f = Int8 -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral CChar
x)
  {-# INLINE uncast #-}

instance Castable Word CUInt where
  cast :: forall r. Word -> (CUInt -> IO r) -> IO r
cast Word
x CUInt -> IO r
f = CUInt -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
x)
  {-# INLINE cast #-}
  uncast :: forall r. CUInt -> (Word -> IO r) -> IO r
uncast CUInt
x Word -> IO r
f = Word -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
x)
  {-# INLINE uncast #-}

instance Castable Word8 CChar where
  cast :: forall r. Word8 -> (CChar -> IO r) -> IO r
cast Word8
x CChar -> IO r
f = CChar -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
x)
  {-# INLINE cast #-}
  uncast :: forall r. CChar -> (Word8 -> IO r) -> IO r
uncast CChar
x Word8 -> IO r
f = Word8 -> IO r
f (forall a b. (Integral a, Num b) => a -> b
fromIntegral CChar
x)
  {-# INLINE uncast #-}

instance Castable Double CDouble where
  cast :: forall r. Double -> (CDouble -> IO r) -> IO r
cast Double
x CDouble -> IO r
f = CDouble -> IO r
f (forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
x)
  {-# INLINE cast #-}
  uncast :: forall r. CDouble -> (Double -> IO r) -> IO r
uncast CDouble
x Double -> IO r
f = Double -> IO r
f (forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
x)
  {-# INLINE uncast #-}

instance Castable [Double] (Ptr CDouble) where
  cast :: forall r. [Double] -> (Ptr CDouble -> IO r) -> IO r
cast [Double]
xs Ptr CDouble -> IO r
f = forall a. Storable a => [a] -> IO (Ptr a)
newArray (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (Real a, Fractional b) => a -> b
realToFrac [Double]
xs) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CDouble -> IO r
f
  {-# INLINE cast #-}
  uncast :: forall r. Ptr CDouble -> ([Double] -> IO r) -> IO r
uncast Ptr CDouble
xs [Double] -> IO r
f = forall a. HasCallStack => a
undefined
  {-# INLINE uncast #-}

instance Castable [Int] (Ptr CInt) where
  cast :: forall r. [Int] -> (Ptr CInt -> IO r) -> IO r
cast [Int]
xs Ptr CInt -> IO r
f = forall a. Storable a => [a] -> IO (Ptr a)
newArray (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
xs) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CInt -> IO r
f
  {-# INLINE cast #-}
  uncast :: forall r. Ptr CInt -> ([Int] -> IO r) -> IO r
uncast Ptr CInt
xs [Int] -> IO r
f = forall a. HasCallStack => a
undefined
  {-# INLINE uncast #-}

instance Castable ByteString CString where
  cast :: forall r. ByteString -> (CString -> IO r) -> IO r
cast ByteString
x CString -> IO r
f = forall r. ByteString -> (CString -> IO r) -> IO r
useAsCString ByteString
x CString -> IO r
f
  {-# INLINE cast #-}
  uncast :: forall r. CString -> (ByteString -> IO r) -> IO r
uncast CString
x ByteString -> IO r
f = CString -> IO ByteString
packCString CString
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ByteString -> IO r
f
  {-# INLINE uncast #-}

instance Castable [ByteString] (Ptr CString) where
  cast :: forall r. [ByteString] -> (Ptr CString -> IO r) -> IO r
cast [ByteString]
xs Ptr CString -> IO r
f = do [CString]
ys <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (\ByteString
x -> forall r. ByteString -> (CString -> IO r) -> IO r
useAsCString ByteString
x forall (m :: * -> *) a. Monad m => a -> m a
return) [ByteString]
xs
                 forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [CString]
ys forall a b. (a -> b) -> a -> b
$ \Ptr CString
cptr -> Ptr CString -> IO r
f Ptr CString
cptr
  {-# INLINE cast #-}
  uncast :: forall r. Ptr CString -> ([ByteString] -> IO r) -> IO r
uncast Ptr CString
xs [ByteString] -> IO r
f = forall a. HasCallStack => a
undefined
  {-# INLINE uncast #-}

instance Castable String CString where
  cast :: forall r. String -> (CString -> IO r) -> IO r
cast String
x CString -> IO r
f = forall r. String -> (CString -> IO r) -> IO r
withCString String
x CString -> IO r
f
  {-# INLINE cast #-}
  uncast :: forall r. CString -> (String -> IO r) -> IO r
uncast CString
x String -> IO r
f = CString -> IO String
peekCString CString
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= String -> IO r
f
  {-# INLINE uncast #-}

instance (Castable a a') => Castable (Maybe a) (Maybe a') where
  cast :: forall r. Maybe a -> (Maybe a' -> IO r) -> IO r
cast Maybe a
Nothing Maybe a' -> IO r
f = Maybe a' -> IO r
f forall a. Maybe a
Nothing
  cast (Just a
v) Maybe a' -> IO r
f = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
v (\a'
v -> Maybe a' -> IO r
f (forall a. a -> Maybe a
Just a'
v))
  {-# INLINE cast #-}
  uncast :: forall r. Maybe a' -> (Maybe a -> IO r) -> IO r
uncast Maybe a'
Nothing Maybe a -> IO r
f = Maybe a -> IO r
f forall a. Maybe a
Nothing
  uncast (Just a'
v) Maybe a -> IO r
f = forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
v (\a
v -> Maybe a -> IO r
f (forall a. a -> Maybe a
Just a
v)) 
  {-# INLINE uncast #-}

instance (CppObject a) => Castable (ForeignPtr a) (Ptr a) where
  cast :: forall r. ForeignPtr a -> (Ptr a -> IO r) -> IO r
cast ForeignPtr a
x Ptr a -> IO r
f = forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr a
x Ptr a -> IO r
f
  {-# INLINE cast #-}
  uncast :: forall r. Ptr a -> (ForeignPtr a -> IO r) -> IO r
uncast Ptr a
x ForeignPtr a -> IO r
f = forall a. CppObject a => Ptr a -> IO (ForeignPtr a)
fromPtr Ptr a
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ForeignPtr a -> IO r
f
  {-# INLINE uncast #-}

--------------------------------------------------------------------------------
-- Tuples of Castable
--------------------------------------------------------------------------------

instance (Castable a a', Castable b b') => Castable (a,b) (a',b') where
  cast :: forall r. (a, b) -> ((a', b') -> IO r) -> IO r
cast (a
t0,b
t1) (a', b') -> IO r
f = do
    a'
t0' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b'
t1' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a', b') -> IO r
f (a'
t0',b'
t1')
  uncast :: forall r. (a', b') -> ((a, b) -> IO r) -> IO r
uncast (a'
t0,b'
t1) (a, b) -> IO r
f = do
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast b'
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b) -> IO r
f (a
t0',b
t1')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (Castable a a', Castable b b', Castable c c') => Castable (a,b,c) (a',b',c') where
  cast :: forall r. (a, b, c) -> ((a', b', c') -> IO r) -> IO r
cast (a
t0,b
t1,c
t2) (a', b', c') -> IO r
f = do
    a'
t0' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b'
t1' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c'
t2' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast c
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a', b', c') -> IO r
f (a'
t0',b'
t1',c'
t2')
  uncast :: forall r. (a', b', c') -> ((a, b, c) -> IO r) -> IO r
uncast (a'
t0,b'
t1,c'
t2) (a, b, c) -> IO r
f = do
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast b'
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast c'
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c) -> IO r
f (a
t0',b
t1',c
t2')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (Castable a a', Castable b b', Castable c c', Castable d d') => Castable (a,b,c,d) (a',b',c',d') where
  cast :: forall r. (a, b, c, d) -> ((a', b', c', d') -> IO r) -> IO r
cast (a
t0,b
t1,c
t2,d
t3) (a', b', c', d') -> IO r
f = do
    a'
t0' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b'
t1' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c'
t2' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast c
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d'
t3' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast d
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a', b', c', d') -> IO r
f (a'
t0',b'
t1',c'
t2',d'
t3')
  uncast :: forall r. (a', b', c', d') -> ((a, b, c, d) -> IO r) -> IO r
uncast (a'
t0,b'
t1,c'
t2,d'
t3) (a, b, c, d) -> IO r
f = do
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast b'
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast c'
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast d'
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d) -> IO r
f (a
t0',b
t1',c
t2',d
t3')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (Castable a a', Castable b b', Castable c c', Castable d d', Castable e e') => Castable (a,b,c,d,e) (a',b',c',d',e') where
  cast :: forall r. (a, b, c, d, e) -> ((a', b', c', d', e') -> IO r) -> IO r
cast (a
t0,b
t1,c
t2,d
t3,e
t4) (a', b', c', d', e') -> IO r
f = do
    a'
t0' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b'
t1' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c'
t2' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast c
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d'
t3' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast d
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e'
t4' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast e
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a', b', c', d', e') -> IO r
f (a'
t0',b'
t1',c'
t2',d'
t3',e'
t4')
  uncast :: forall r. (a', b', c', d', e') -> ((a, b, c, d, e) -> IO r) -> IO r
uncast (a'
t0,b'
t1,c'
t2,d'
t3,e'
t4) (a, b, c, d, e) -> IO r
f = do
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast b'
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast c'
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast d'
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e
t4' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast e'
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d, e) -> IO r
f (a
t0',b
t1',c
t2',d
t3',e
t4')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (Castable a a', Castable b b', Castable c c',
          Castable d d', Castable e e', Castable f f') => Castable (a,b,c,d,e,f) (a',b',c',d',e',f') where
  cast :: forall r.
(a, b, c, d, e, f) -> ((a', b', c', d', e', f') -> IO r) -> IO r
cast (a
t0,b
t1,c
t2,d
t3,e
t4,f
t5) (a', b', c', d', e', f') -> IO r
f = do
    a'
t0' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b'
t1' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c'
t2' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast c
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d'
t3' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast d
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e'
t4' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast e
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    f'
t5' <- forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast f
t5 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a', b', c', d', e', f') -> IO r
f (a'
t0',b'
t1',c'
t2',d'
t3',e'
t4',f'
t5')
  uncast :: forall r.
(a', b', c', d', e', f') -> ((a, b, c, d, e, f) -> IO r) -> IO r
uncast (a'
t0,b'
t1,c'
t2,d'
t3,e'
t4,f'
t5) (a, b, c, d, e, f) -> IO r
f = do
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast a'
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast b'
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast c'
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast d'
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e
t4' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast e'
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    f
t5' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast f'
t5 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d, e, f) -> IO r
f (a
t0',b
t1',c
t2',d
t3',e
t4',f
t5')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

--------------------------------------------------------------------------------
-- These casts convert the value from C++ Tuple(CppTuple) to Haskell Tuple.
-- Reverse side is not supported.
--------------------------------------------------------------------------------

instance (CppTuple2 c, Castable a (A c), Castable b (B c)) => Castable (a,b) c where
  cast :: forall r. (a, b) -> (c -> IO r) -> IO r
cast (a
t0',b
t1') c -> IO r
f = do
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
t0' forall a b. (a -> b) -> a -> b
$ \A c
t0 -> 
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast b
t1' forall a b. (a -> b) -> a -> b
$ \B c
t1 -> 
        forall m. CppTuple2 m => (A m, B m) -> IO m
makeTuple2 (A c
t0,B c
t1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= c -> IO r
f
  uncast :: forall r. c -> ((a, b) -> IO r) -> IO r
uncast c
t (a, b) -> IO r
f = do
    A c
t0 <- forall m. CppTuple2 m => m -> IO (A m)
get0 c
t
    B c
t1 <- forall m. CppTuple2 m => m -> IO (B m)
get1 c
t
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast A c
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast B c
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b) -> IO r
f (a
t0',b
t1')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (CppTuple3 d, Castable a (A d), Castable b (B d), Castable c (C d)) => Castable (a,b,c) d where
  cast :: forall r. (a, b, c) -> (d -> IO r) -> IO r
cast (a, b, c)
_ d -> IO r
_ = forall a. HasCallStack => String -> a
error String
"Attempted to cast a 3-tuple from Haskell to C++, this is not supported."
  uncast :: forall r. d -> ((a, b, c) -> IO r) -> IO r
uncast d
t (a, b, c) -> IO r
f = do
    A d
t0 <- forall m. CppTuple2 m => m -> IO (A m)
get0 d
t
    B d
t1 <- forall m. CppTuple2 m => m -> IO (B m)
get1 d
t
    C d
t2 <- forall m. CppTuple3 m => m -> IO (C m)
get2 d
t
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast A d
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast B d
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast C d
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c) -> IO r
f (a
t0',b
t1',c
t2')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (CppTuple4 e, Castable a (A e), Castable b (B e), Castable c (C e), Castable d (D e)) => Castable (a,b,c,d) e where
  cast :: forall r. (a, b, c, d) -> (e -> IO r) -> IO r
cast (a, b, c, d)
_ e -> IO r
_ = forall a. HasCallStack => String -> a
error String
"Attempted to cast a 4-tuple from Haskell to C++, this is not supported."
  uncast :: forall r. e -> ((a, b, c, d) -> IO r) -> IO r
uncast e
t (a, b, c, d) -> IO r
f = do
    A e
t0 <- forall m. CppTuple2 m => m -> IO (A m)
get0 e
t
    B e
t1 <- forall m. CppTuple2 m => m -> IO (B m)
get1 e
t
    C e
t2 <- forall m. CppTuple3 m => m -> IO (C m)
get2 e
t
    D e
t3 <- forall m. CppTuple4 m => m -> IO (D m)
get3 e
t
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast A e
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast B e
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast C e
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast D e
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d) -> IO r
f (a
t0',b
t1',c
t2',d
t3')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (CppTuple5 f, Castable a (A f), Castable b (B f), Castable c (C f), Castable d (D f), Castable e (E f)) => Castable (a,b,c,d,e) f where
  cast :: forall r. (a, b, c, d, e) -> (f -> IO r) -> IO r
cast (a, b, c, d, e)
_ f -> IO r
_ = forall a. HasCallStack => String -> a
error String
"Attempted to cast a 5-tuple from Haskell to C++, this is not supported."
  uncast :: forall r. f -> ((a, b, c, d, e) -> IO r) -> IO r
uncast f
t (a, b, c, d, e) -> IO r
f = do
    A f
t0 <- forall m. CppTuple2 m => m -> IO (A m)
get0 f
t
    B f
t1 <- forall m. CppTuple2 m => m -> IO (B m)
get1 f
t
    C f
t2 <- forall m. CppTuple3 m => m -> IO (C m)
get2 f
t
    D f
t3 <- forall m. CppTuple4 m => m -> IO (D m)
get3 f
t
    E f
t4 <- forall m. CppTuple5 m => m -> IO (E m)
get4 f
t
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast A f
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast B f
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast C f
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast D f
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e
t4' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast E f
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d, e) -> IO r
f (a
t0',b
t1',c
t2',d
t3',e
t4')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

instance (CppTuple6 g,
          Castable a (A g), Castable b (B g), Castable c (C g),
          Castable d (D g), Castable e (E g), Castable f (F g)) => Castable (a,b,c,d,e,f) g where
  cast :: forall r. (a, b, c, d, e, f) -> (g -> IO r) -> IO r
cast (a, b, c, d, e, f)
_ g -> IO r
_ = forall a. HasCallStack => String -> a
error String
"Attempted to cast a 6-tuple from Haskell to C++, this is not supported."
  uncast :: forall r. g -> ((a, b, c, d, e, f) -> IO r) -> IO r
uncast g
t (a, b, c, d, e, f) -> IO r
f = do
    A g
t0 <- forall m. CppTuple2 m => m -> IO (A m)
get0 g
t
    B g
t1 <- forall m. CppTuple2 m => m -> IO (B m)
get1 g
t
    C g
t2 <- forall m. CppTuple3 m => m -> IO (C m)
get2 g
t
    D g
t3 <- forall m. CppTuple4 m => m -> IO (D m)
get3 g
t
    E g
t4 <- forall m. CppTuple5 m => m -> IO (E m)
get4 g
t
    F g
t5 <- forall m. CppTuple6 m => m -> IO (F m)
get5 g
t
    a
t0' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast A g
t0 forall (m :: * -> *) a. Monad m => a -> m a
return
    b
t1' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast B g
t1 forall (m :: * -> *) a. Monad m => a -> m a
return
    c
t2' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast C g
t2 forall (m :: * -> *) a. Monad m => a -> m a
return
    d
t3' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast D g
t3 forall (m :: * -> *) a. Monad m => a -> m a
return
    e
t4' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast E g
t4 forall (m :: * -> *) a. Monad m => a -> m a
return
    f
t5' <- forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast F g
t5 forall (m :: * -> *) a. Monad m => a -> m a
return
    (a, b, c, d, e, f) -> IO r
f (a
t0',b
t1',c
t2',d
t3',e
t4',f
t5')
  {-# INLINE cast #-}
  {-# INLINE uncast #-}

--------------------------------------------------------------------------------
-- Cast functions for various numbers of arguments without retryWithGC
--------------------------------------------------------------------------------

cast0 :: (Castable a ca) => (IO ca) -> IO a
cast0 :: forall a ca. Castable a ca => IO ca -> IO a
cast0 IO ca
f = (IO ca
f) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ca
ca -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast ca
ca forall (m :: * -> *) a. Monad m => a -> m a
return

cast1 :: (Castable a ca, Castable y cy)
       => (ca -> IO cy) -> a -> IO y
cast1 :: forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
cast1 ca -> IO cy
f a
a = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca -> (ca -> IO cy
f ca
ca) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast2 :: (Castable a ca, Castable x1 cx1, Castable y cy)
       => (ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 :: forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
cast2 ca -> cx1 -> IO cy
f a
a x1
x1 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                    (ca -> cx1 -> IO cy
f ca
ca cx1
cx1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast3 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy)
       => (ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2-> IO y
cast3 :: forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
cast3 ca -> cx1 -> cx2 -> IO cy
f a
a x1
x1 x2
x2 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                     forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                       forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
                         (ca -> cx1 -> cx2 -> IO cy
f ca
ca cx1
cx1 cx2
cx2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast4 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 :: forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
cast4 ca -> cx1 -> cx2 -> cx3 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
                            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
                              (ca -> cx1 -> cx2 -> cx3 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast5 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy) -> a -> x1 -> x2 -> x3 -> x4 -> IO y
cast5 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> IO y
cast5 ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            (ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast6 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy) -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> IO y
cast6 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> IO y
cast6 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast7 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> IO y
cast7 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> IO y
cast7 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast8 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> IO y
cast8 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> IO y
cast8 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast9 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> IO y
cast9 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable y cy) =>
(ca
 -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> IO y
cast9 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast10 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
           Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> IO y
cast10 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> IO y
cast10 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast11 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> IO y
cast11 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> IO y
cast11 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast12 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> IO y
cast12 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> IO y
cast12 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                         (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast13 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> IO y
cast13 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> IO y
cast13 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11 cx12
cx12) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast14 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> cx13 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> x13 -> IO y
cast14 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> IO y
cast14 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast15 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable x14 cx14, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> cx13 -> cx14 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> x13 -> x14 -> IO y
cast15 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 x14 cx14 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable x14 cx14, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> cx14
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> x14
-> IO y
cast15 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 x14
x14 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x14
x14 forall a b. (a -> b) -> a -> b
$ \cx14
cx14 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13 cx14
cx14) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast16 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable x14 cx14, Castable x15 cx15, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> cx13 -> cx14 -> cx15 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> x13 -> x14 -> x15 -> IO y
cast16 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 x14 cx14 x15 cx15 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable x14 cx14, Castable x15 cx15, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> cx14
 -> cx15
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> x14
-> x15
-> IO y
cast16 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 x14
x14 x15
x15 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x14
x14 forall a b. (a -> b) -> a -> b
$ \cx14
cx14 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x15
x15 forall a b. (a -> b) -> a -> b
$ \cx15
cx15 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13 cx14
cx14 cx15
cx15) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast17 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable x14 cx14,
            Castable x15 cx15, Castable x16 cx16,
            Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> cx13 -> cx14 -> cx15 -> cx16 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> x13 -> x14 -> x15 -> x16 -> IO y
cast17 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 x14 cx14 x15 cx15 x16
       cx16 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable x14 cx14, Castable x15 cx15, Castable x16 cx16,
 Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> cx14
 -> cx15
 -> cx16
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> x14
-> x15
-> x16
-> IO y
cast17 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 x14
x14 x15
x15 x16
x16 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x14
x14 forall a b. (a -> b) -> a -> b
$ \cx14
cx14 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x15
x15 forall a b. (a -> b) -> a -> b
$ \cx15
cx15 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x16
x16 forall a b. (a -> b) -> a -> b
$ \cx16
cx16 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13 cx14
cx14 cx15
cx15 cx16
cx16) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

cast21 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable x14 cx14, Castable x15 cx15,
            Castable x16 cx16, Castable x17 cx17, Castable x18 cx18, Castable x19 cx19, Castable x20 cx20,
            Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 ->
           cx10 -> cx11 -> cx12 -> cx13 -> cx14 -> cx15 -> cx16 -> cx17 -> cx18 -> cx19 ->
           cx20 -> IO cy) ->
          a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 ->
          x10 -> x11 -> x12 -> x13 -> x14 -> x15 -> x16 -> x17 -> x18 -> x19 -> x20 -> IO y
cast21 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 x14 cx14 x15 cx15 x16
       cx16 x17 cx17 x18 cx18 x19 cx19 x20 cx20 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable x14 cx14, Castable x15 cx15, Castable x16 cx16,
 Castable x17 cx17, Castable x18 cx18, Castable x19 cx19,
 Castable x20 cx20, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> cx14
 -> cx15
 -> cx16
 -> cx17
 -> cx18
 -> cx19
 -> cx20
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> x14
-> x15
-> x16
-> x17
-> x18
-> x19
-> x20
-> IO y
cast21 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> cx17
-> cx18
-> cx19
-> cx20
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 x14
x14 x15
x15 x16
x16 x17
x17 x18
x18 x19
x19 x20
x20 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x14
x14 forall a b. (a -> b) -> a -> b
$ \cx14
cx14 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x15
x15 forall a b. (a -> b) -> a -> b
$ \cx15
cx15 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x16
x16 forall a b. (a -> b) -> a -> b
$ \cx16
cx16 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x17
x17 forall a b. (a -> b) -> a -> b
$ \cx17
cx17 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x18
x18 forall a b. (a -> b) -> a -> b
$ \cx18
cx18 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x19
x19 forall a b. (a -> b) -> a -> b
$ \cx19
cx19 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x20
x20 forall a b. (a -> b) -> a -> b
$ \cx20
cx20 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> cx17
-> cx18
-> cx19
-> cx20
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9
                              cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13 cx14
cx14 cx15
cx15 cx16
cx16 cx17
cx17 cx18
cx18 cx19
cx19
                              cx20
cx20) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


cast22 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable x13 cx13, Castable x14 cx14,
            Castable x15 cx15, Castable x16 cx16, Castable x17 cx17, Castable x18 cx18, Castable x19 cx19,
            Castable x20 cx20, Castable x21 cx21,
            Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 ->
           cx10 -> cx11 -> cx12 -> cx13 -> cx14 -> cx15 -> cx16 -> cx17 -> cx18 -> cx19 ->
           cx20 -> cx21 -> IO cy) ->
          a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 ->
          x10 -> x11 -> x12 -> x13 -> x14 -> x15 -> x16 -> x17 -> x18 -> x19 -> x20 -> x21 -> IO y
cast22 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 x13 cx13 x14 cx14 x15 cx15 x16
       cx16 x17 cx17 x18 cx18 x19 cx19 x20 cx20 x21 cx21 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable x13 cx13,
 Castable x14 cx14, Castable x15 cx15, Castable x16 cx16,
 Castable x17 cx17, Castable x18 cx18, Castable x19 cx19,
 Castable x20 cx20, Castable x21 cx21, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> cx13
 -> cx14
 -> cx15
 -> cx16
 -> cx17
 -> cx18
 -> cx19
 -> cx20
 -> cx21
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> x13
-> x14
-> x15
-> x16
-> x17
-> x18
-> x19
-> x20
-> x21
-> IO y
cast22 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> cx17
-> cx18
-> cx19
-> cx20
-> cx21
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 x13
x13 x14
x14 x15
x15 x16
x16 x17
x17 x18
x18 x19
x19 x20
x20 x21
x21 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x12
x12 forall a b. (a -> b) -> a -> b
$ \cx12
cx12 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x13
x13 forall a b. (a -> b) -> a -> b
$ \cx13
cx13 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x14
x14 forall a b. (a -> b) -> a -> b
$ \cx14
cx14 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x15
x15 forall a b. (a -> b) -> a -> b
$ \cx15
cx15 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x16
x16 forall a b. (a -> b) -> a -> b
$ \cx16
cx16 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x17
x17 forall a b. (a -> b) -> a -> b
$ \cx17
cx17 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x18
x18 forall a b. (a -> b) -> a -> b
$ \cx18
cx18 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x19
x19 forall a b. (a -> b) -> a -> b
$ \cx19
cx19 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x20
x20 forall a b. (a -> b) -> a -> b
$ \cx20
cx20 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x21
x21 forall a b. (a -> b) -> a -> b
$ \cx21
cx21 ->
                            (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> cx13
-> cx14
-> cx15
-> cx16
-> cx17
-> cx18
-> cx19
-> cx20
-> cx21
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9
                              cx10
cx10 cx11
cx11 cx12
cx12 cx13
cx13 cx14
cx14 cx15
cx15 cx16
cx16 cx17
cx17 cx18
cx18 cx19
cx19
                              cx20
cx20 cx21
cx21) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


{-# INLINE cast0 #-}
{-# INLINE cast1 #-}
{-# INLINE cast2 #-}
{-# INLINE cast3 #-}
{-# INLINE cast4 #-}
{-# INLINE cast5 #-}
{-# INLINE cast6 #-}
{-# INLINE cast7 #-}
{-# INLINE cast8 #-}
{-# INLINE cast9 #-}
{-# INLINE cast10 #-}
{-# INLINE cast11 #-}
{-# INLINE cast12 #-}
{-# INLINE cast13 #-}
{-# INLINE cast14 #-}
{-# INLINE cast15 #-}
{-# INLINE cast16 #-}
{-# INLINE cast17 #-}
{-# INLINE cast21 #-}
{-# INLINE cast22 #-}

--------------------------------------------------------------------------------
-- Cast functions with retryWithGC
--------------------------------------------------------------------------------

_cast0 :: (Castable a ca) => (IO ca) -> IO a
_cast0 :: forall a ca. Castable a ca => IO ca -> IO a
_cast0 IO ca
f = forall a. IO a -> IO a
retryWithGC (IO ca
f) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ca
ca -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast ca
ca forall (m :: * -> *) a. Monad m => a -> m a
return

_cast1 :: (Castable a ca, Castable y cy)
       => (ca -> IO cy) -> a -> IO y
_cast1 :: forall a ca y cy.
(Castable a ca, Castable y cy) =>
(ca -> IO cy) -> a -> IO y
_cast1 ca -> IO cy
f a
a = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca -> forall a. IO a -> IO a
retryWithGC (ca -> IO cy
f ca
ca) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast2 :: (Castable a ca, Castable x1 cx1, Castable y cy)
       => (ca -> cx1 -> IO cy) -> a -> x1 -> IO y
_cast2 :: forall a ca x1 cx1 y cy.
(Castable a ca, Castable x1 cx1, Castable y cy) =>
(ca -> cx1 -> IO cy) -> a -> x1 -> IO y
_cast2 ca -> cx1 -> IO cy
f a
a x1
x1 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                    forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> IO cy
f ca
ca cx1
cx1) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast3 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy)
       => (ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2-> IO y
_cast3 :: forall a ca x1 cx1 x2 cx2 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable y cy) =>
(ca -> cx1 -> cx2 -> IO cy) -> a -> x1 -> x2 -> IO y
_cast3 ca -> cx1 -> cx2 -> IO cy
f a
a x1
x1 x2
x2 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                     forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                       forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
                         forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> IO cy
f ca
ca cx1
cx1 cx2
cx2) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast4 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
_cast4 :: forall a ca x1 cx1 x2 cx2 x3 cx3 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> IO cy) -> a -> x1 -> x2 -> x3 -> IO y
_cast4 ca -> cx1 -> cx2 -> cx3 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 = forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
                          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
                            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
                              forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast5 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy) -> a -> x1 -> x2 -> x3 -> x4 -> IO y
_cast5 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> IO y
_cast5 ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> cx4 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


_cast6 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy) -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> IO y
_cast6 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> IO y
_cast6 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast7 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> IO y
_cast7 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> IO y
_cast7 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast8 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> IO y
_cast8 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable y cy) =>
(ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> IO y
_cast8 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


_cast9 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> IO y
_cast9 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable y cy) =>
(ca
 -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> IO y
_cast9 ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a. IO a -> IO a
retryWithGC (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast10 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
           Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
           Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> IO y
_cast10 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> IO cy)
-> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> IO y
_cast10 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a. IO a -> IO a
retryWithGC (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast11 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> IO y
_cast11 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> IO y
_cast11 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a. IO a -> IO a
retryWithGC (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return

_cast12 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> IO y
_cast12 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> IO y
_cast12 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x9
x9 forall a b. (a -> b) -> a -> b
$ \cx9
cx9 ->
                      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x10
x10 forall a b. (a -> b) -> a -> b
$ \cx10
cx10 ->
                        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x11
x11 forall a b. (a -> b) -> a -> b
$ \cx11
cx11 ->
                         forall a. IO a -> IO a
retryWithGC (ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> IO cy
f ca
ca cx1
cx1 cx2
cx2 cx3
cx3 cx4
cx4 cx5
cx5 cx6
cx6 cx7
cx7 cx8
cx8 cx9
cx9 cx10
cx10 cx11
cx11) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \cy
cy -> forall a b r. Castable a b => b -> (a -> IO r) -> IO r
uncast cy
cy forall (m :: * -> *) a. Monad m => a -> m a
return


_cast13 :: (Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3, Castable x4 cx4,
            Castable x5 cx5, Castable x6 cx6, Castable x7 cx7, Castable x8 cx8, Castable x9 cx9,
            Castable x10 cx10, Castable x11 cx11, Castable x12 cx12, Castable y cy)
       => (ca -> cx1 -> cx2 -> cx3 -> cx4 -> cx5 -> cx6 -> cx7 -> cx8 -> cx9 -> cx10 -> cx11 -> cx12 -> IO cy)
          -> a -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> x9 -> x10 -> x11 -> x12 -> IO y
_cast13 :: forall a ca x1 cx1 x2 cx2 x3 cx3 x4 cx4 x5 cx5 x6 cx6 x7 cx7 x8 cx8
       x9 cx9 x10 cx10 x11 cx11 x12 cx12 y cy.
(Castable a ca, Castable x1 cx1, Castable x2 cx2, Castable x3 cx3,
 Castable x4 cx4, Castable x5 cx5, Castable x6 cx6, Castable x7 cx7,
 Castable x8 cx8, Castable x9 cx9, Castable x10 cx10,
 Castable x11 cx11, Castable x12 cx12, Castable y cy) =>
(ca
 -> cx1
 -> cx2
 -> cx3
 -> cx4
 -> cx5
 -> cx6
 -> cx7
 -> cx8
 -> cx9
 -> cx10
 -> cx11
 -> cx12
 -> IO cy)
-> a
-> x1
-> x2
-> x3
-> x4
-> x5
-> x6
-> x7
-> x8
-> x9
-> x10
-> x11
-> x12
-> IO y
_cast13 ca
-> cx1
-> cx2
-> cx3
-> cx4
-> cx5
-> cx6
-> cx7
-> cx8
-> cx9
-> cx10
-> cx11
-> cx12
-> IO cy
f a
a x1
x1 x2
x2 x3
x3 x4
x4 x5
x5 x6
x6 x7
x7 x8
x8 x9
x9 x10
x10 x11
x11 x12
x12 =
  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast a
a forall a b. (a -> b) -> a -> b
$ \ca
ca ->
    forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x1
x1 forall a b. (a -> b) -> a -> b
$ \cx1
cx1 ->
      forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x2
x2 forall a b. (a -> b) -> a -> b
$ \cx2
cx2 ->
        forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x3
x3 forall a b. (a -> b) -> a -> b
$ \cx3
cx3 ->
          forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x4
x4 forall a b. (a -> b) -> a -> b
$ \cx4
cx4 ->
            forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x5
x5 forall a b. (a -> b) -> a -> b
$ \cx5
cx5 ->
              forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x6
x6 forall a b. (a -> b) -> a -> b
$ \cx6
cx6 ->
                forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x7
x7 forall a b. (a -> b) -> a -> b
$ \cx7
cx7 ->
                  forall a b r. Castable a b => a -> (b -> IO r) -> IO r
cast x8
x8 forall a b. (a -> b) -> a -> b
$ \cx8
cx8 ->
                    forall a b r. Castable a b => a -> (b -> IO r) -> IO r