packages feed

geomancy-0.4.0.0: src/Geomancy/Swizzle/I64Vec/Extend.hs

{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Geomancy.Swizzle.I64Vec.Extend () where

import GHC.Records (HasField(..))

import Geomancy.I64Vec2 (I64Vec2, withI64Vec2)
import Geomancy.I64Vec3 (I64Vec3, i64vec3, withI64Vec3)
import Geomancy.I64Vec4 (I64Vec4, i64vec4)

instance HasField "xy0" I64Vec2 I64Vec3 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec3 x y 0

instance HasField "xy1" I64Vec2 I64Vec3 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec3 x y 1

instance HasField "xy00" I64Vec2 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec4 x y 0 0

instance HasField "xy01" I64Vec2 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec4 x y 0 1

instance HasField "xy10" I64Vec2 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec4 x y 1 0

instance HasField "xy11" I64Vec2 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec2 v \x y -> i64vec4 x y 1 1

instance HasField "xyz0" I64Vec3 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec3 v \x y z -> i64vec4 x y z 0

instance HasField "xyz1" I64Vec3 I64Vec4 where
  {-# INLINE getField #-}
  getField v = withI64Vec3 v \x y z -> i64vec4 x y z 1