{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, TypeFamilies #-}moduleUtils.PointwheretypePta=(a,a)instanceNuma=>Num(Pta)where(x1,x2)+(y1,y2)=(x1+y1,x2+y2)(x1,x2)*(y1,y2)=(x1*y1,x2*y2)(x1,x2)-(y1,y2)=(x1-y1,x2-y2)negate(x1,x2)=(negatex1,negatex2)abs(x1,x2)=(absx1,absx2)-- Not really mathematical, but the type must be samesignum(x1,x2)=(signumx1,signumx2)-- DittofromIntegerx=(fromIntegerx,fromIntegerx)-- As wellnorm2::(Numa)=>Pta->anorm2(a,b)=a*a+b*bnorm=sqrt.norm2(a,b)>/(c,d)=(a`div`c,b`div`d)