headerHS = ["{-# LANGUAGE ForeignFunctionInterface #-}"
           ,"{-# LANGUAGE CApiFFI #-}"
           ,"{-# LANGUAGE CPP     #-}"
           ,"{-# LANGUAGE DeriveGeneric #-}"
           ,"{-# LANGUAGE DeriveAnyClass #-}"
           ,"{-# LANGUAGE FlexibleContexts #-}"
           ,"{-# LANGUAGE FlexibleInstances    #-}"
           ,"{-# LANGUAGE ScopedTypeVariables  #-}"
           ,"{-# LANGUAGE TypeOperators        #-}"
           ,"{-# LANGUAGE DataKinds            #-}"
           ,"{-# LANGUAGE UndecidableInstances #-}"
           ,""
           ,"module TestCases where"
           ,""
           ,"import GHC.Generics hiding (C1,S1)"
           ,"import GHC.TypeLits "
           ,"import Foreign.C.Types"
           ,"import Foreign.Storable"
           ,"import Foreign.Storable.Generic"
           ,"import Foreign.Ptr (Ptr)"
           ,"import Foreign.ForeignPtr (ForeignPtr, mallocForeignPtr)"
           ,"import Foreign.Marshal.Alloc (malloc, free)"
           ,"import Foreign.Marshal.Array (mallocArray, pokeArray)"
           ,""
           ,"import Foreign.Storable.Generic.Tools"
           ,"import Foreign.Storable.Generic.Internal"
           ,"import Data.Int"
           ,"import Control.Monad (sequence, liftM)"
           ,"import System.Exit"
           ,""
           ,"import Test.QuickCheck"
           ,"-- The module tests the memory alignment of Storable data-types "
           ,"-- derived with generic-storable package. "
           ,""
           ,"-- Adding parametric polimorphism to reduce the boilerplate."
           ,"class (Storable a) => Checkable a where"
           ,"  -- | Checks whether the fields are the same"
           ,"  checkFields  :: Ptr a -> Ptr a -> IO Bool "
           ,"  -- | Checks whether the offsets are the same"
           ,"  checkOffsets :: a -> Ptr Int16 -> IO Bool "
           ,"  -- | Checks whether the size is the same"
           ,"  getSize    :: a -> IO Int              "
           ,"  -- | Checks whether the alignment is the same"
           ,"  getAlignment :: a-> IO Int              "
           ,"  "
           ,"  new          :: a -> IO (Ptr a)"
           ,""
           ,""
           ,"newStorable :: Storable a => a -> IO (Ptr a)"
           ,"newStorable val = do"
           ,"  ptr <- malloc"
           ,"  poke ptr val"
           ,"  return ptr"
           ,""
           ,""
           ,"class SumOffsets' f where"
           ,"    sumOffsets' :: f p -> [Offset]"
           ,""
           ,"instance (SumOffsets' f) => SumOffsets' (M1 D t f) where"
           ,"    sumOffsets' (M1 v) = sumOffsets' v"
           ,""
           ,"instance (GStorable' f, SumOffsets' f) => SumOffsets' (M1 C t f) where"
           ,"    sumOffsets' (M1 v) = internalOffsets v"
           ,""
           ,"instance (SumOffsets' f, SumOffsets' g) => SumOffsets' (f :+: g) where"
           ,"    sumOffsets' (L1 v) = sumOffsets' v"
           ,"    sumOffsets' (R1 v) = sumOffsets' v"
           ,""
           ,"instance SumOffsets' (M1 S t f) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (f :*: g) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (K1 i a) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (U1) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (V1) where"
           ,"    sumOffsets' _ = undefined"
           ,""
           ,""
           ,"goffsets :: (SumOffsets' (Rep a), GStorable a, Generic a) => a -> [Int16]"
           ,"goffsets v = map fromIntegral $ sumOffsets' (from v)"
--           ,"goffsets :: (GStorable' (Rep a), GStorable a, Generic a) => a -> [Int16]"
--           ,"goffsets v = map fromIntegral $ internalOffsets (from v)"
           ,""
           ]
headerHS = ["{-# LANGUAGE ForeignFunctionInterface #-}"
           ,"{-# LANGUAGE CApiFFI #-}"
           ,"{-# LANGUAGE CPP     #-}"
           ,"{-# LANGUAGE DeriveGeneric #-}"
           ,"{-# LANGUAGE DeriveAnyClass #-}"
           ,"{-# LANGUAGE FlexibleContexts #-}"
           ,"{-# LANGUAGE FlexibleInstances    #-}"
           ,"{-# LANGUAGE ScopedTypeVariables  #-}"
           ,"{-# LANGUAGE TypeOperators        #-}"
           ,"{-# LANGUAGE DataKinds            #-}"
           ,"{-# LANGUAGE UndecidableInstances #-}"
           ,""
           ,"module TestCases where"
           ,""
           ,"import GHC.Generics hiding (C1,S1)"
           ,"import GHC.TypeLits "
           ,"import Foreign.C.Types"
           ,"import Foreign.Storable"
           ,"import Foreign.Storable.Generic"
           ,"import Foreign.Ptr (Ptr)"
           ,"import Foreign.ForeignPtr (ForeignPtr, mallocForeignPtr)"
           ,"import Foreign.Marshal.Alloc (malloc, free)"
           ,"import Foreign.Marshal.Array (mallocArray, pokeArray)"
           ,""
           ,"import Foreign.Storable.Generic.Tools"
           ,"import Foreign.Storable.Generic.Internal"
           ,"import Data.Int"
           ,"import Control.Monad (sequence, liftM)"
           ,"import System.Exit"
           ,""
           ,"import Test.QuickCheck"
           ,"-- The module tests the memory alignment of Storable data-types "
           ,"-- derived with generic-storable package. "
           ,""
           ,"-- Adding parametric polimorphism to reduce the boilerplate."
           ,"class (Storable a) => Checkable a where"
           ,"  -- | Checks whether the fields are the same"
           ,"  checkFields  :: Ptr a -> Ptr a -> IO Bool "
           ,"  -- | Checks whether the offsets are the same"
           ,"  checkOffsets :: a -> Ptr Int16 -> IO Bool "
           ,"  -- | Checks whether the size is the same"
           ,"  getSize    :: a -> IO Int              "
           ,"  -- | Checks whether the alignment is the same"
           ,"  getAlignment :: a-> IO Int              "
           ,"  "
           ,"  new          :: a -> IO (Ptr a)"
           ,""
           ,""
           ,"newStorable :: Storable a => a -> IO (Ptr a)"
           ,"newStorable val = do"
           ,"  ptr <- malloc"
           ,"  poke ptr val"
           ,"  return ptr"
           ,""
           ,""
           ,"class SumOffsets' f where"
           ,"    sumOffsets' :: f p -> [Offset]"
           ,""
           ,"instance (SumOffsets' f) => SumOffsets' (M1 D t f) where"
           ,"    sumOffsets' (M1 v) = sumOffsets' v"
           ,""
           ,"instance (GStorable' f, SumOffsets' f) => SumOffsets' (M1 C t f) where"
           ,"    sumOffsets' (M1 v) = internalOffsets v"
           ,""
           ,"instance (SumOffsets' f, SumOffsets' g) => SumOffsets' (f :+: g) where"
           ,"    sumOffsets' (L1 v) = sumOffsets' v"
           ,"    sumOffsets' (R1 v) = sumOffsets' v"
           ,""
           ,"instance SumOffsets' (M1 S t f) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (f :*: g) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (K1 i a) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (U1) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (V1) where"
           ,"    sumOffsets' _ = undefined"
           ,""
           ,""
           ,"goffsets :: (SumOffsets' (Rep a), GStorable a, Generic a) => a -> [Int16]"
           ,"goffsets v = map fromIntegral $ sumOffsets' (from v)"
--           ,"goffsets :: (GStorable' (Rep a), GStorable a, Generic a) => a -> [Int16]"
--           ,"goffsets v = map fromIntegral $ internalOffsets (from v)"
           ,""
           ]
headerHS = ["{-# LANGUAGE ForeignFunctionInterface #-}"
           ,"{-# LANGUAGE CApiFFI #-}"
           ,"{-# LANGUAGE CPP     #-}"
           ,"{-# LANGUAGE DeriveGeneric #-}"
           ,"{-# LANGUAGE DeriveAnyClass #-}"
           ,"{-# LANGUAGE FlexibleContexts #-}"
           ,"{-# LANGUAGE FlexibleInstances    #-}"
           ,"{-# LANGUAGE ScopedTypeVariables  #-}"
           ,"{-# LANGUAGE TypeOperators        #-}"
           ,"{-# LANGUAGE DataKinds            #-}"
           ,"{-# LANGUAGE UndecidableInstances #-}"
           ,""
           ,"module TestCases where"
           ,""
           ,"import GHC.Generics hiding (C1,S1)"
           ,"import GHC.TypeLits "
           ,"import Foreign.C.Types"
           ,"import Foreign.Storable"
           ,"import Foreign.Storable.Generic"
           ,"import Foreign.Ptr (Ptr)"
           ,"import Foreign.ForeignPtr (ForeignPtr, mallocForeignPtr)"
           ,"import Foreign.Marshal.Alloc (malloc, free)"
           ,"import Foreign.Marshal.Array (mallocArray, pokeArray)"
           ,""
           ,"import Foreign.Storable.Generic.Tools"
           ,"import Foreign.Storable.Generic.Internal"
           ,"import Data.Int"
           ,"import Control.Monad (sequence, liftM)"
           ,"import System.Exit"
           ,""
           ,"import Test.QuickCheck"
           ,"-- The module tests the memory alignment of Storable data-types "
           ,"-- derived with generic-storable package. "
           ,""
           ,"-- Adding parametric polimorphism to reduce the boilerplate."
           ,"class (Storable a) => Checkable a where"
           ,"  -- | Checks whether the fields are the same"
           ,"  checkFields  :: Ptr a -> Ptr a -> IO Bool "
           ,"  -- | Checks whether the offsets are the same"
           ,"  checkOffsets :: a -> Ptr Int16 -> IO Bool "
           ,"  -- | Checks whether the size is the same"
           ,"  getSize    :: a -> IO Int              "
           ,"  -- | Checks whether the alignment is the same"
           ,"  getAlignment :: a-> IO Int              "
           ,"  "
           ,"  new          :: a -> IO (Ptr a)"
           ,""
           ,""
           ,"newStorable :: Storable a => a -> IO (Ptr a)"
           ,"newStorable val = do"
           ,"  ptr <- malloc"
           ,"  poke ptr val"
           ,"  return ptr"
           ,""
           ,""
           ,"class SumOffsets' f where"
           ,"    sumOffsets' :: f p -> [Offset]"
           ,""
           ,"instance (SumOffsets' f) => SumOffsets' (M1 D t f) where"
           ,"    sumOffsets' (M1 v) = sumOffsets' v"
           ,""
           ,"instance (GStorable' f, SumOffsets' f) => SumOffsets' (M1 C t f) where"
           ,"    sumOffsets' (M1 v) = internalOffsets v"
           ,""
           ,"instance (SumOffsets' f, SumOffsets' g) => SumOffsets' (f :+: g) where"
           ,"    sumOffsets' (L1 v) = sumOffsets' v"
           ,"    sumOffsets' (R1 v) = sumOffsets' v"
           ,""
           ,"instance SumOffsets' (M1 S t f) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (f :*: g) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (K1 i a) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (U1) where"
           ,"    sumOffsets' _ = undefined"
           ,"instance SumOffsets' (V1) where"
           ,"    sumOffsets' _ = undefined"
           ,""
           ,""
           ,"goffsets :: (SumOffsets' (Rep a), GStorable a, Generic a) => a -> [Int16]"
           ,"goffsets v = map fromIntegral $ sumOffsets' (from v)"
--           ,"goffsets :: (GStorable' (Rep a), GStorable a, Generic a) => a -> [Int16]"
--           ,"goffsets v = map fromIntegral $ internalOffsets (from v)"
           ,""
           ]