-- | An incomplete implementation of interval aritrhmetic.moduleData.Number.Interval(Interval,ival,getIval)wheredataIntervala=Iaaival::(Orda)=>a->a->Intervalaivallh|l<=h=Ilh|otherwise=error"Interval.ival: low > high"getIval::Intervala->(a,a)getIval(Ilh)=(l,h)instance(Orda)=>Eq(Intervala)whereIlh==Il'h'=l==h'&&h==l'Ilh/=Il'h'=h<l'||h'<linstance(Orda)=>Ord(Intervala)whereIlh<Il'h'=h<l'Ilh<=Il'h'=h<=l'Ilh>Il'h'=l>h'Ilh>=Il'h'=l>=h'-- These funcions are partial, so we just leave them out.compare__=error"Interval compare"max__=error"Interval max"min__=error"Interval min"instance(Eqa,Showa)=>Show(Intervala)whereshowsPrecp(Ilh)|l==h=showsPrecpl|otherwise=showsPrecpl.showString"..".showsPrecphinstance(Orda,Numa)=>Num(Intervala)whereIlh+Il'h'=I(l+l')(h+h')Ilh-Il'h'=I(l-h')(h-l')Ilh*Il'h'=I(minimumxs)(maximumxs)wherexs=[l*l',l*h',h*l',h*h']negate(Ilh)=I(-h)(-l)-- leave out abs and signumabs_=error"Interval abs"signum_=error"Interval signum"fromIntegeri=Illwherel=fromIntegeriinstance(Orda,Fractionala)=>Fractional(Intervala)whereIlh/Il'h'|signuml'==signumh'&&l'/=0=I(minimumxs)(maximumxs)|otherwise=error"Interval: division by 0"wherexs=[l/l',l/h',h/l',h/h']fromRationalr=Illwherel=fromRationalr