Movatterモバイル変換
[0]ホーム
moduleGHC.ClasseswhereimportGHC.IntegerimportGHC.Magic()importGHC.OrderingimportGHC.PrimimportGHC.TupleimportGHC.TypesimportGHC.UnitimportGHC.Generics(Arity(..),Associativity(..),Fixity(..))infix4==,/=,<,<=,>=,>infixr3&&infixr2||default()classEqawhere(==),(/=)::a->a->Boolx/=y=not(x==y)x==y=not(x/=y)derivinginstanceEq()derivinginstance(Eqa,Eqb)=>Eq(a,b)derivinginstance(Eqa,Eqb,Eqc)=>Eq(a,b,c)derivinginstance(Eqa,Eqb,Eqc,Eqd)=>Eq(a,b,c,d)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe)=>Eq(a,b,c,d,e)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf)=>Eq(a,b,c,d,e,f)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg)=>Eq(a,b,c,d,e,f,g)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh)=>Eq(a,b,c,d,e,f,g,h)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi)=>Eq(a,b,c,d,e,f,g,h,i)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj)=>Eq(a,b,c,d,e,f,g,h,i,j)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk)=>Eq(a,b,c,d,e,f,g,h,i,j,k)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql)=>Eq(a,b,c,d,e,f,g,h,i,j,k,l)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm)=>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm,Eqn)=>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m,n)derivinginstance(Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm,Eqn,Eqo)=>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)instance(Eqa)=>Eq[a]where[]==[]=True(x:xs)==(y:ys)=x==y&&xs==ys_xs==_ys=FalsederivinginstanceEqBoolderivinginstanceEqOrderinginstanceEqCharwhere(C#c1)==(C#c2)=c1`eqChar#`c2(C#c1)/=(C#c2)=c1`neChar#`c2instanceEqIntegerwhere(==)=eqInteger(/=)=neqIntegerinstanceEqFloatwhere(F#x)==(F#y)=x`eqFloat#`yinstanceEqDoublewhere(D#x)==(D#y)=x==##yinstanceEqIntwhere(==)=eqInt(/=)=neInteqInt,neInt::Int->Int->Bool(I#x)`eqInt`(I#y)=x==#y(I#x)`neInt`(I#y)=x/=#yclass(Eqa)=>Ordawherecompare::a->a->Ordering(<),(<=),(>),(>=)::a->a->Boolmax,min::a->a->acomparexy=ifx==ythenEQelseifx<=ythenLTelseGTx<y=casecomparexyof{LT->True;_->False}x<=y=casecomparexyof{GT->False;_->True}x>y=casecomparexyof{GT->True;_->False}x>=y=casecomparexyof{LT->False;_->True}maxxy=ifx<=ythenyelsexminxy=ifx<=ythenxelseyderivinginstanceOrd()derivinginstance(Orda,Ordb)=>Ord(a,b)derivinginstance(Orda,Ordb,Ordc)=>Ord(a,b,c)derivinginstance(Orda,Ordb,Ordc,Ordd)=>Ord(a,b,c,d)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde)=>Ord(a,b,c,d,e)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf)=>Ord(a,b,c,d,e,f)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg)=>Ord(a,b,c,d,e,f,g)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh)=>Ord(a,b,c,d,e,f,g,h)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi)=>Ord(a,b,c,d,e,f,g,h,i)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj)=>Ord(a,b,c,d,e,f,g,h,i,j)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk)=>Ord(a,b,c,d,e,f,g,h,i,j,k)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl)=>Ord(a,b,c,d,e,f,g,h,i,j,k,l)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm)=>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm,Ordn)=>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m,n)derivinginstance(Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm,Ordn,Ordo)=>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)instance(Orda)=>Ord[a]wherecompare[][]=EQcompare[](_:_)=LTcompare(_:_)[]=GTcompare(x:xs)(y:ys)=casecomparexyofEQ->comparexsysother->otherderivinginstanceOrdBoolderivinginstanceOrdOrderinginstanceOrdCharwhere(C#c1)>(C#c2)=c1`gtChar#`c2(C#c1)>=(C#c2)=c1`geChar#`c2(C#c1)<=(C#c2)=c1`leChar#`c2(C#c1)<(C#c2)=c1`ltChar#`c2instanceOrdIntegerwhere(<=)=leInteger(>)=gtInteger(<)=ltInteger(>=)=geIntegercompare=compareIntegerinstanceOrdFloatwhere(F#x)`compare`(F#y)=ifx`ltFloat#`ythenLTelseifx`eqFloat#`ythenEQelseGT(F#x)<(F#y)=x`ltFloat#`y(F#x)<=(F#y)=x`leFloat#`y(F#x)>=(F#y)=x`geFloat#`y(F#x)>(F#y)=x`gtFloat#`yinstanceOrdDoublewhere(D#x)`compare`(D#y)=ifx<##ythenLTelseifx==##ythenEQelseGT(D#x)<(D#y)=x<##y(D#x)<=(D#y)=x<=##y(D#x)>=(D#y)=x>=##y(D#x)>(D#y)=x>##yinstanceOrdIntwherecompare=compareInt(<)=ltInt(<=)=leInt(>=)=geInt(>)=gtIntgtInt,geInt,ltInt,leInt::Int->Int->Bool(I#x)`gtInt`(I#y)=x>#y(I#x)`geInt`(I#y)=x>=#y(I#x)`ltInt`(I#y)=x<#y(I#x)`leInt`(I#y)=x<=#ycompareInt::Int->Int->Ordering(I#x#)`compareInt`(I#y#)=compareInt#x#y#compareInt#::Int#->Int#->OrderingcompareInt#x#y#|x#<#y#=LT|x#==#y#=EQ|True=GT(&&)::Bool->Bool->BoolTrue&&x=xFalse&&_=False(||)::Bool->Bool->BoolTrue||_=TrueFalse||x=xnot::Bool->BoolnotTrue=FalsenotFalse=TruederivinginstanceEqArityderivinginstanceEqAssociativityderivinginstanceEqFixityderivinginstanceOrdArityderivinginstanceOrdAssociativityderivinginstanceOrdFixity
[8]ページ先頭