packages feed

geomancy-0.4.1.0 / src / Geomancy / Swizzle / IVec / Extend.hs

{-# LANGUAGE BlockArguments #-}{-# LANGUAGE DataKinds #-}{-# LANGUAGE FlexibleInstances #-}{-# LANGUAGE MultiParamTypeClasses #-}{-# OPTIONS_GHC -Wno-orphans #-}module Geomancy.Swizzle.IVec.Extend () whereimport GHC.Records (HasField(..))import Geomancy.IVec2 (IVec2, withIVec2)import Geomancy.IVec3 (IVec3, ivec3, withIVec3)import Geomancy.IVec4 (IVec4, ivec4)instance HasField "xy0" IVec2 IVec3 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec3 x y 0instance HasField "xy1" IVec2 IVec3 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec3 x y 1instance HasField "xy00" IVec2 IVec4 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec4 x y 0 0instance HasField "xy01" IVec2 IVec4 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec4 x y 0 1instance HasField "xy10" IVec2 IVec4 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec4 x y 1 0instance HasField "xy11" IVec2 IVec4 where  {-# INLINE getField #-}  getField v = withIVec2 v \x y -> ivec4 x y 1 1instance HasField "xyz0" IVec3 IVec4 where  {-# INLINE getField #-}  getField v = withIVec3 v \x y z -> ivec4 x y z 0instance HasField "xyz1" IVec3 IVec4 where  {-# INLINE getField #-}  getField v = withIVec3 v \x y z -> ivec4 x y z 1