Bodigrim / arithmoi

Number theory: primes, arithmetic functions, modular computations, special sequences
http://hackage.haskell.org/package/arithmoi
MIT License
147 stars 40 forks source link

Add more usable interface to Sqrt module #108

Closed viviag closed 6 years ago

viviag commented 6 years ago

Covers #87 (Not closes since there is still strange internal design) Possible workaround here:

viviag commented 6 years ago

Seems that approach with toType functions is applicable for every restriction e.g. existing wrapper Prime. See message of https://github.com/cartazio/arithmoi/pull/108/commits/b0d0c1bd94f67321b08d59c233ca3ae9306e1572

viviag commented 6 years ago

Here we expect p is prime and it's checked earlier. We do not push errors here back and can expect nontermination later if p is actually not a prime let (Just c) = Moduli.sqrtModMaybe (-1) (FieldCharacteristic (PrimeNat . integerToNatural $ p) 1)

Bodigrim commented 6 years ago

Merged! Huge thanks for your contribution.