packages feed

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

{-# LANGUAGE BlockArguments #-}{-# LANGUAGE DataKinds #-}{-# LANGUAGE FlexibleInstances #-}{-# LANGUAGE MultiParamTypeClasses #-}{-# OPTIONS_GHC -Wno-orphans #-}module Geomancy.Swizzle.DVec.Extend () whereimport GHC.Records (HasField(..))import Geomancy.DVec2 (DVec2, withDVec2)import Geomancy.DVec3 (DVec3, dvec3, withDVec3)import Geomancy.DVec4 (DVec4, dvec4)instance HasField "xy0" DVec2 DVec3 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec3 x y 0instance HasField "xy1" DVec2 DVec3 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec3 x y 1instance HasField "xy00" DVec2 DVec4 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec4 x y 0 0instance HasField "xy01" DVec2 DVec4 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec4 x y 0 1instance HasField "xy10" DVec2 DVec4 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec4 x y 1 0instance HasField "xy11" DVec2 DVec4 where  {-# INLINE getField #-}  getField v = withDVec2 v \x y -> dvec4 x y 1 1instance HasField "xyz0" DVec3 DVec4 where  {-# INLINE getField #-}  getField v = withDVec3 v \x y z -> dvec4 x y z 0instance HasField "xyz1" DVec3 DVec4 where  {-# INLINE getField #-}  getField v = withDVec3 v \x y z -> dvec4 x y z 1