{-# LANGUAGE EmptyDataDecls #-}moduleModulowheredataZzero::Zzero=undefineddataSapredecessor::Sa->apredecessor=undefinedclassNatawheretoInteger::a->IntegerinstanceNatZwheretoInteger_=0instanceNata=>Nat(Sa)wheretoInteger=(1+).Modulo.toInteger.predecessornewtypeModuloab=Modulo(a,b)instanceEqb=>Eq(Moduloab)whereModulo(_,x)==Modulo(_,y)=x==yinstanceShowb=>Show(Moduloab)whereshow(Modulo(_,x))=showxinstance(Nata,Integralb)=>Num(Moduloab)whereModulo(m,x)+Modulo(_,y)=Modulo(m,z)wherez=(x+y)`mod`fromInteger(Modulo.toIntegerm)Modulo(m,x)-Modulo(_,y)=Modulo(m,z)wherez=(x-y)`mod`fromInteger(Modulo.toIntegerm)Modulo(m,x)*Modulo(_,y)=Modulo(m,z)wherez=(x*y)`mod`fromInteger(Modulo.toIntegerm)abs=idsignum(Modulo(m,x))=Modulo$(m,signumx)fromIntegern=Modulo(m,z)wherez=fromInteger(n`mod`Modulo.toIntegerm)m=undefined::Nata=>atypeZero=ZtypeOne=SZerotypeTwo=SOne;typeModulo2=ModuloTwoInttypeThree=STwo;typeModulo3=ModuloThreeInttypeFour=SThree;typeModulo4=ModuloFourInttypeFive=SFour;typeModulo5=ModuloFiveInttypeSix=SFive;typeModulo6=ModuloSixInttypeSeven=SSix;typeModulo7=ModuloSevenInttypeEight=SSeven;typeModulo8=ModuloEightInttypeNine=SEight;typeModulo9=ModuloNineInttypeTen=SNine;typeModulo10=ModuloTenInt
nobsun
#4948()
[
Haskell
]
Rating3/3=1.00
Rating3/3=1.00-0+
2 replies [ reply ]