primTypesMatrixArbitrary :: (forall ty . (PrimType ty, Typeable ty, Show ty, Ord ty) => Proxy ty -> Gen ty -> a)
                         -> [(String, [(String, a)])]
primTypesMatrixArbitrary f =
    [ ("Words",
        [ ("W8", f (Proxy :: Proxy Word8) arbitrary)
        , ("W16", f (Proxy :: Proxy Word16) arbitrary)
        , ("W32", f (Proxy :: Proxy Word32) arbitrary)
        , ("W64", f (Proxy :: Proxy Word64) arbitrary)
        , ("W128", f (Proxy :: Proxy Word128) arbitrary)
        , ("W256", f (Proxy :: Proxy Word256) arbitrary)
        , ("Word", f (Proxy :: Proxy Word) arbitrary)
        ])
    , ("Ints",
        [ ("I8", f (Proxy :: Proxy Int8) arbitrary)
        , ("I16", f (Proxy :: Proxy Int16) arbitrary)
        , ("I32", f (Proxy :: Proxy Int32) arbitrary)
        , ("I64", f (Proxy :: Proxy Int64) arbitrary)
        , ("Int", f (Proxy :: Proxy Int) arbitrary)
        ])
    , ("Floating",
        [ ("FP32", f (Proxy :: Proxy Float) arbitrary)
        , ("FP64", f (Proxy :: Proxy Double) arbitrary)
        ])
    , ("C-Types",
        [ ("CChar", f (Proxy :: Proxy CChar) (CChar <$> arbitrary))
        , ("CUChar", f (Proxy :: Proxy CUChar) (CUChar <$> arbitrary))
        ])
    , ("Endian",
        [ ("BE-W16", f (Proxy :: Proxy (BE Word16)) (toBE <$> arbitrary))
        , ("BE-W32", f (Proxy :: Proxy (BE Word32)) (toBE <$> arbitrary))
        , ("BE-W64", f (Proxy :: Proxy (BE Word64)) (toBE <$> arbitrary))
        , ("LE-W16", f (Proxy :: Proxy (LE Word16)) (toLE <$> arbitrary))
        , ("LE-W32", f (Proxy :: Proxy (LE Word32)) (toLE <$> arbitrary))
        , ("LE-W64", f (Proxy :: Proxy (LE Word64)) (toLE <$> arbitrary))
        ])
    ]
primTypesMatrixArbitrary :: (forall ty . (PrimType ty, Typeable ty, Show ty, Ord ty) => Proxy ty -> Gen ty -> a)
                         -> [(String, [(String, a)])]
primTypesMatrixArbitrary f =
    [ ("Words",
        [ ("W8", f (Proxy :: Proxy Word8) arbitrary)
        , ("W16", f (Proxy :: Proxy Word16) arbitrary)
        , ("W32", f (Proxy :: Proxy Word32) arbitrary)
        , ("W64", f (Proxy :: Proxy Word64) arbitrary)
        , ("W128", f (Proxy :: Proxy Word128) arbitrary)
        , ("W256", f (Proxy :: Proxy Word256) arbitrary)
        , ("Word", f (Proxy :: Proxy Word) arbitrary)
        ])
    , ("Ints",
        [ ("I8", f (Proxy :: Proxy Int8) arbitrary)
        , ("I16", f (Proxy :: Proxy Int16) arbitrary)
        , ("I32", f (Proxy :: Proxy Int32) arbitrary)
        , ("I64", f (Proxy :: Proxy Int64) arbitrary)
        , ("Int", f (Proxy :: Proxy Int) arbitrary)
        ])
    , ("Floating",
        [ ("FP32", f (Proxy :: Proxy Float) arbitrary)
        , ("FP64", f (Proxy :: Proxy Double) arbitrary)
        ])
    , ("C-Types",
        [ ("CChar", f (Proxy :: Proxy CChar) (CChar <$> arbitrary))
        , ("CUChar", f (Proxy :: Proxy CUChar) (CUChar <$> arbitrary))
        ])
    , ("Endian",
        [ ("BE-W16", f (Proxy :: Proxy (BE Word16)) (toBE <$> arbitrary))
        , ("BE-W32", f (Proxy :: Proxy (BE Word32)) (toBE <$> arbitrary))
        , ("BE-W64", f (Proxy :: Proxy (BE Word64)) (toBE <$> arbitrary))
        , ("LE-W16", f (Proxy :: Proxy (LE Word16)) (toLE <$> arbitrary))
        , ("LE-W32", f (Proxy :: Proxy (LE Word32)) (toLE <$> arbitrary))
        , ("LE-W64", f (Proxy :: Proxy (LE Word64)) (toLE <$> arbitrary))
        ])
    ]
primTypesMatrixArbitrary f =
    [ ("Words",
        [ ("W8", f (Proxy :: Proxy Word8) arbitrary)
        , ("W16", f (Proxy :: Proxy Word16) arbitrary)
        , ("W32", f (Proxy :: Proxy Word32) arbitrary)
        , ("W64", f (Proxy :: Proxy Word64) arbitrary)
        , ("W128", f (Proxy :: Proxy Word128) arbitrary)
        , ("W256", f (Proxy :: Proxy Word256) arbitrary)
        , ("Word", f (Proxy :: Proxy Word) arbitrary)
        ])
    , ("Ints",
        [ ("I8", f (Proxy :: Proxy Int8) arbitrary)
        , ("I16", f (Proxy :: Proxy Int16) arbitrary)
        , ("I32", f (Proxy :: Proxy Int32) arbitrary)
        , ("I64", f (Proxy :: Proxy Int64) arbitrary)
        , ("Int", f (Proxy :: Proxy Int) arbitrary)
        ])
    , ("Floating",
        [ ("FP32", f (Proxy :: Proxy Float) arbitrary)
        , ("FP64", f (Proxy :: Proxy Double) arbitrary)
        ])
    , ("C-Types",
        [ ("CChar", f (Proxy :: Proxy CChar) (CChar <$> arbitrary))
        , ("CUChar", f (Proxy :: Proxy CUChar) (CUChar <$> arbitrary))
        ])
    , ("Endian",
        [ ("BE-W16", f (Proxy :: Proxy (BE Word16)) (toBE <$> arbitrary))
        , ("BE-W32", f (Proxy :: Proxy (BE Word32)) (toBE <$> arbitrary))
        , ("BE-W64", f (Proxy :: Proxy (BE Word64)) (toBE <$> arbitrary))
        , ("LE-W16", f (Proxy :: Proxy (LE Word16)) (toLE <$> arbitrary))
        , ("LE-W32", f (Proxy :: Proxy (LE Word32)) (toLE <$> arbitrary))
        , ("LE-W64", f (Proxy :: Proxy (LE Word64)) (toLE <$> arbitrary))
        ])
    ]