Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (15 sloc) 0.472 kb
module Vector2 where
import Control.Applicative
import Graphics.Rendering.OpenGL.GL (Vector2(..))
-- OpenGL Vector2 missing instances for Num, Fractional, etc :-(
instance Num a => Num (Vector2 a) where
(+) = liftA2 (+)
(*) = liftA2 (*)
negate = fmap negate
fromInteger = pure . fromInteger
signum = fmap signum
abs = fmap abs
instance Fractional a => Fractional (Vector2 a) where
(/) = liftA2 (/)
recip = fmap recip
fromRational = pure . fromRational
Jump to Line
Something went wrong with that request. Please try again.