fast-combinatorics 0.1.0.6 → 0.1.0.7
raw patch · 11 files changed
+245/−367 lines, 11 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Numeric.Pure.Combinatorics: hsDoubleFactorial :: Int -> Int
Files
- README.md +5/−3
- ats-src/combinatorics.dats +2/−2
- ats-src/number-theory.dats +2/−2
- ats-src/numerics.dats +7/−9
- bench/Bench.hs +4/−0
- cbits/combinatorics-ffi.c +37/−34
- cbits/numerics-ffi.c +169/−312
- fast-combinatorics.cabal +5/−3
- src/Numeric/Combinatorics.hs +5/−2
- src/Numeric/Pure/Combinatorics.hs +6/−0
- test/Spec.hs +3/−0
README.md view
@@ -7,7 +7,7 @@ building this please open an issue. Currently it is a work-in-progress, being somewhat constrained by the fact that I have-yet to figure out how to share arbitrary-precision types between ATS and Haskell.+yet to figure out how to share arbitrary-precision types between ATS and Haskell. ## Benchmarks @@ -15,18 +15,20 @@ | ----------- | --------------------- | ---- | | `12!` | ATS | 9.301 ns | | `12!` | Haskell | 27.84 ns |+| `19!!` | ATS | 10.07 ns |+| `19!!` | Haskell | 20.82 ns | | ``13 `choose` 4`` | ATS | 12.28 ns | | ``13 `choose` 4`` | Haskell | 28.38 ns | | `isPrime 2017` | ATS | 118.9 ns | | `isPrime 2017` | Haskell | 497.3 ns |-| `3 ^ 7` | ATS | 9.050 ns |+| `3 ^ 7` | ATS | 8.735 ns | | `3 ^ 7` | Haskell | 37.02 ns | ## Building The Haskell library comes with the C bundled, however you may wish to build from source if you are hacking on the library. To that end, you can install-[stack](http://haskellstack.org/), [patscc](http://www.ats-lang.org/Downloads.html), and+[stack](http://haskellstack.org/), [patsopt](http://www.ats-lang.org/Downloads.html), and [pats-filter](https://github.com/Hibou57/PostiATS-Utilities) and build with ```bash
ats-src/combinatorics.dats view
@@ -16,9 +16,9 @@ | k =>> k * dfact(k - 2) // TODO make this more versatile?-fn choose {n : nat}{ m : nat | m <= n } (n : int(n), k : int(m)) : int =+fn choose {n : nat}{ m : nat | m <= n } (n : int(n), k : int(m)) :<> int = let- fun numerator_loop { m : nat | m > 1 } .<m>. (i : int(m)) : int =+ fun numerator_loop { m : nat | m > 1 } .<m>. (i : int(m)) :<> int = case+ i of | 1 => n | 2 => (n - 1) * n
ats-src/number-theory.dats view
@@ -4,8 +4,8 @@ staload "libats/libc/SATS/math.sats" -fun is_even(n : int) : bool =+fn is_even(n : int) :<> bool = n % 2 = 0 -fun is_odd(n : int) : bool =+fn is_odd(n : int) :<> bool = n % 2 = 1
ats-src/numerics.dats view
@@ -3,8 +3,9 @@ #include "share/atspre_staload.hats" staload "libats/libc/SATS/math.sats"+staload UN = "prelude/SATS/unsafe.sats" -fun exp {n : nat} .<n>. (x : int, n : int(n)) : int =+fun exp {n : nat} .<n>. (x : int, n : int(n)) :<> int = case+ x of | 0 => 0 | x => @@ -23,18 +24,15 @@ 1 end -fun sqrt_bad(k : intGt(0)) : [ m : nat ] int(m) =+fun sqrt_int(k : intGt(0)) : [ m : nat ] int(m) = let var pre_bound: int = g0float2int(sqrt_float(g0int2float_int_float(k)))- var bad = fix@ f (n : int) : [ m : nat ] int(m) => case+ n of- | 0 => 0- | n => 1 + f(n - 1)- var bound: [ m : nat ] int(m) = bad(pre_bound)+ var bound: [ m : nat ] int(m) = $UN.cast(pre_bound) in bound end -fun is_prime(k : intGt(0)) : bool =+fn is_prime(k : intGt(0)) : bool = case+ k of | 1 => false | k => @@ -45,7 +43,7 @@ if k % i = 0 then false else- true && loop(i + 1, bound)+ loop(i + 1, bound) else if i = bound then if k % i = 0 then@@ -55,6 +53,6 @@ else true in- loop(2, sqrt_bad(k))+ loop(2, sqrt_int(k)) end end
bench/Bench.hs view
@@ -15,6 +15,10 @@ [ bench "choose" $ nf (13 `choose`) 4 , bench "hsChoose" $ nf (13 `hsChoose`) 4 ]+ , bgroup "double factorial"+ [ bench "doubleFactorial" $ nf doubleFactorial 19+ , bench "hsDoubleFactorial" $ nf hsDoubleFactorial 19+ ] , bgroup "primality check" [ bench "isPrime" $ nf isPrime 2017 , bench "hsIsPrime" $ nf hsIsPrime 2017
cbits/combinatorics-ffi.c view
@@ -1,7 +1,7 @@ /* ** ** The C code is generated by [ATS/Postiats-0-3-8]-** The starting compilation time is: 2017-12-31: 1h: 4m+** The starting compilation time is: 2018-1-1: 11h:20m ** */ @@ -572,7 +572,7 @@ } /* end of [dfact_3] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 362(line=19, offs=4) -- 718(line=31, offs=6)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 362(line=19, offs=4) -- 722(line=31, offs=6) */ /* local: fact_0$0(level=0)@@ -591,11 +591,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 362(line=19, offs=4) -- 718(line=31, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 362(line=19, offs=4) -- 722(line=31, offs=6) */ ATSINSflab(__patsflab_choose_4): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 434(line=20, offs=3) -- 718(line=31, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 436(line=20, offs=3) -- 722(line=31, offs=6) */ /* letpush(beg)@@ -605,7 +605,7 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 630(line=27, offs=5) -- 712(line=30, offs=42)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 634(line=27, offs=5) -- 716(line=30, offs=42) */ ATScaseof_beg() /*@@ -613,7 +613,7 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 649(line=28, offs=9) -- 650(line=28, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 653(line=28, offs=9) -- 654(line=28, offs=10) */ ATSINSlab(__atstmplab13): /*@@ -621,7 +621,7 @@ */ ATSifnthen(ATSCKpat_int(arg1, ATSPMVint(0))) { ATSINSgoto(__atstmplab15) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 650(line=28, offs=10) -- 650(line=28, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 654(line=28, offs=10) -- 654(line=28, offs=10) */ ATSINSlab(__atstmplab14): /*@@ -631,14 +631,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 654(line=28, offs=14) -- 655(line=28, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 658(line=28, offs=14) -- 659(line=28, offs=15) */ ATSINSmove(tmpret6, ATSPMVi0nt(1)) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 664(line=29, offs=9) -- 665(line=29, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 668(line=29, offs=9) -- 669(line=29, offs=10) */ ATSINSlab(__atstmplab15): /*@@ -646,7 +646,7 @@ */ ATSifnthen(ATSCKpat_int(arg1, ATSPMVint(1))) { ATSINSgoto(__atstmplab17) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 665(line=29, offs=10) -- 665(line=29, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 669(line=29, offs=10) -- 669(line=29, offs=10) */ ATSINSlab(__atstmplab16): /*@@ -656,14 +656,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 669(line=29, offs=14) -- 670(line=29, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 673(line=29, offs=14) -- 674(line=29, offs=15) */ ATSINSmove(tmpret6, arg0) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 680(line=30, offs=10) -- 680(line=30, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 684(line=30, offs=10) -- 684(line=30, offs=10) */ ATSINSlab(__atstmplab17): /*@@ -673,17 +673,17 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 685(line=30, offs=15) -- 701(line=30, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 689(line=30, offs=15) -- 705(line=30, offs=31) */ ATSINSmove(tmp13, numerator_loop_5(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 705(line=30, offs=35) -- 711(line=30, offs=41)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 709(line=30, offs=35) -- 715(line=30, offs=41) */ ATSINSmove(tmp14, fact_0(arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 685(line=30, offs=15) -- 711(line=30, offs=41)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 689(line=30, offs=15) -- 715(line=30, offs=41) */ ATSINSmove(tmpret6, atspre_g0int_div_int(tmp13, tmp14)) ; @@ -695,7 +695,7 @@ ATScaseof_end() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 434(line=20, offs=3) -- 718(line=31, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 436(line=20, offs=3) -- 722(line=31, offs=6) */ /* INSletpop()@@ -705,7 +705,7 @@ } /* end of [choose_4] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 446(line=21, offs=9) -- 620(line=25, offs=52)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 448(line=21, offs=9) -- 624(line=25, offs=52) */ /* local: numerator_loop_5$0(level=1)@@ -727,11 +727,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 446(line=21, offs=9) -- 620(line=25, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 448(line=21, offs=9) -- 624(line=25, offs=52) */ ATSINSflab(__patsflab_numerator_loop_5): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 514(line=22, offs=7) -- 620(line=25, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 518(line=22, offs=7) -- 624(line=25, offs=52) */ ATScaseof_beg() /*@@ -739,15 +739,15 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 535(line=23, offs=11) -- 536(line=23, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 539(line=23, offs=11) -- 540(line=23, offs=12) */ ATSINSlab(__atstmplab8): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 488(line=21, offs=51) -- 489(line=21, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 490(line=21, offs=51) -- 491(line=21, offs=52) */ ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab10) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 536(line=23, offs=12) -- 536(line=23, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 540(line=23, offs=12) -- 540(line=23, offs=12) */ ATSINSlab(__atstmplab9): /*@@ -757,22 +757,22 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 540(line=23, offs=16) -- 541(line=23, offs=17)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 544(line=23, offs=16) -- 545(line=23, offs=17) */ ATSINSmove(tmpret7, env0) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 552(line=24, offs=11) -- 553(line=24, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 556(line=24, offs=11) -- 557(line=24, offs=12) */ ATSINSlab(__atstmplab10): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 488(line=21, offs=51) -- 489(line=21, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 490(line=21, offs=51) -- 491(line=21, offs=52) */ ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(2))) { ATSINSgoto(__atstmplab12) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 553(line=24, offs=12) -- 553(line=24, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 557(line=24, offs=12) -- 557(line=24, offs=12) */ ATSINSlab(__atstmplab11): /*@@ -782,12 +782,12 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 558(line=24, offs=17) -- 563(line=24, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 562(line=24, offs=17) -- 567(line=24, offs=22) */ ATSINSmove(tmp8, atspre_g1int_sub_int(env0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 557(line=24, offs=16) -- 568(line=24, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 561(line=24, offs=16) -- 572(line=24, offs=27) */ ATSINSmove(tmpret7, atspre_g1int_mul_int(tmp8, env0)) ; @@ -795,7 +795,7 @@ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 580(line=25, offs=12) -- 580(line=25, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 584(line=25, offs=12) -- 584(line=25, offs=12) */ ATSINSlab(__atstmplab12): /*@@ -805,27 +805,27 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 586(line=25, offs=18) -- 591(line=25, offs=23)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 590(line=25, offs=18) -- 595(line=25, offs=23) */ ATSINSmove(tmp10, atspre_g1int_add_int(env0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 586(line=25, offs=18) -- 595(line=25, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 590(line=25, offs=18) -- 599(line=25, offs=27) */ ATSINSmove(tmp9, atspre_g1int_sub_int(tmp10, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 614(line=25, offs=46) -- 619(line=25, offs=51)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 618(line=25, offs=46) -- 623(line=25, offs=51) */ ATSINSmove(tmp12, atspre_g1int_sub_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 599(line=25, offs=31) -- 620(line=25, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 603(line=25, offs=31) -- 624(line=25, offs=52) */ ATSINSmove(tmp11, numerator_loop_5(env0, tmp12)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 585(line=25, offs=17) -- 620(line=25, offs=52)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/combinatorics.dats: 589(line=25, offs=17) -- 624(line=25, offs=52) */ ATSINSmove(tmpret7, atspre_g0int_mul_int(tmp9, tmp11)) ; @@ -955,6 +955,9 @@ /* dynexnlst-initize(end) */+/* local */+/* in of [local] */+/* end of [local] */ } /* ATSendif */ ATSfunbody_end() ATSreturn_void(tmpret_void) ;
cbits/numerics-ffi.c view
@@ -1,7 +1,7 @@ /* ** ** The C code is generated by [ATS/Postiats-0-3-8]-** The starting compilation time is: 2017-12-31: 1h:12m+** The starting compilation time is: 2018-1-1: 11h:20m ** */ @@ -282,9 +282,8 @@ ATSdyncst_mac(atspre_g0float2int_float_int) ATSdyncst_mac(atslib_libats_libc_sqrt_float) ATSdyncst_mac(atspre_g0int2float_int_float)-ATSdyncst_mac(atspre_g1int_add_int)-ATSdyncst_mac(atspre_g0int_sub_int) ATSdyncst_mac(atspre_g1int_lt_int)+ATSdyncst_mac(atspre_g1int_add_int) ATSdyncst_mac(atspre_g1int_eq_int) /* dyncstlst-declaration(end)@@ -353,31 +352,27 @@ ATSstatic() atstkind_t0ype(atstype_int)-sqrt_bad_12(atstkind_t0ype(atstype_int)) ;--ATSstatic()-atstkind_t0ype(atstype_int)-__patsfun_14(atstkind_t0ype(atstype_int)) ;+sqrt_int_12(atstkind_t0ype(atstype_int)) ; ATSstatic() atstkind_t0ype(atstype_bool)-is_prime_17(atstkind_t0ype(atstype_int)) ;+is_prime_14(atstkind_t0ype(atstype_int)) ; ATSstatic() atstkind_t0ype(atstype_bool)-loop_18(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ;+loop_15(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; #if(0) #if(0) ATSextern() atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__lt_g1int_int__19(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ;+ATSLIB_056_prelude__lt_g1int_int__16(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; #endif // end of [QUALIFIED] #endif // end of [TEMPLATE] ATSstatic() atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__lt_g1int_int__19__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ;+ATSLIB_056_prelude__lt_g1int_int__16__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; ATSstatic() atstkind_t0ype(atstype_bool)@@ -387,13 +382,13 @@ #if(0) ATSextern() atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__eq_g1int_int__23(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ;+ATSLIB_056_prelude__eq_g1int_int__21(atstkind_t0ype(atstyvar_type(tk)), atstkind_t0ype(atstype_int)) ; #endif // end of [QUALIFIED] #endif // end of [TEMPLATE] ATSstatic() atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__eq_g1int_int__23__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ;+ATSLIB_056_prelude__eq_g1int_int__21__1(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; ATSstatic() atstkind_t0ype(atstype_bool)@@ -411,33 +406,8 @@ exp_ats(atstkind_t0ype(atstype_int), atstkind_t0ype(atstype_int)) ; #endif // end of [QUALIFIED] -ATSclosurerize_beg(__patsfun_14, (), (atstkind_t0ype(atstype_int)), atstkind_t0ype(atstype_int))-typedef-ATSstruct {-atstype_funptr cfun ;-} __patsfun_14__closure_t0ype ;-ATSstatic()-atstkind_t0ype(atstype_int)-__patsfun_14__cfun-(-__patsfun_14__closure_t0ype *p_cenv, atstkind_t0ype(atstype_int) arg0-)-{-ATSFCreturn(__patsfun_14(arg0)) ;-} /* end of [cfun] */-ATSstatic()-atstype_cloptr-__patsfun_14__closureinit-(-__patsfun_14__closure_t0ype *p_cenv-)-{-p_cenv->cfun = __patsfun_14__cfun ;-return p_cenv ;-} /* end of [closureinit] */-ATSclosurerize_end() /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 108(line=7, offs=5) -- 467(line=24, offs=10)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 148(line=8, offs=5) -- 509(line=25, offs=10) */ /* local: exp_0$0(level=0)@@ -463,11 +433,11 @@ /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 108(line=7, offs=5) -- 467(line=24, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 148(line=8, offs=5) -- 509(line=25, offs=10) */ ATSINSflab(__patsflab_exp_0): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 160(line=8, offs=3) -- 467(line=24, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 202(line=9, offs=3) -- 509(line=25, offs=10) */ ATScaseof_beg() /*@@ -475,15 +445,15 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 177(line=9, offs=7) -- 178(line=9, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 219(line=10, offs=7) -- 220(line=10, offs=8) */ ATSINSlab(__atstmplab0): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 129(line=7, offs=26) -- 130(line=7, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 169(line=8, offs=26) -- 170(line=8, offs=27) */ ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(0))) { ATSINSgoto(__atstmplab2) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 178(line=9, offs=8) -- 178(line=9, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 220(line=10, offs=8) -- 220(line=10, offs=8) */ ATSINSlab(__atstmplab1): /*@@ -493,14 +463,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 182(line=9, offs=12) -- 183(line=9, offs=13)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 224(line=10, offs=12) -- 225(line=10, offs=13) */ ATSINSmove(tmpret0, ATSPMVi0nt(0)) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 191(line=10, offs=8) -- 191(line=10, offs=8)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 233(line=11, offs=8) -- 233(line=11, offs=8) */ ATSINSlab(__atstmplab2): /*@@ -510,29 +480,29 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 219(line=12, offs=12) -- 224(line=12, offs=17)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 261(line=13, offs=12) -- 266(line=13, offs=17) */ ATSINSmove(tmp1, ATSLIB_056_prelude__gt_g1int_int__1__1(arg1, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 216(line=12, offs=9) -- 457(line=23, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 258(line=13, offs=9) -- 499(line=24, offs=12) */ ATSif( tmp1 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 240(line=13, offs=11) -- 432(line=21, offs=14)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 282(line=14, offs=11) -- 474(line=22, offs=14) */ /* letpush(beg) */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 265(line=14, offs=22) -- 271(line=14, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 307(line=15, offs=22) -- 313(line=15, offs=28) */ ATSINSmove(tmp6, atspre_g1int_half_int(arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 294(line=15, offs=22) -- 299(line=15, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 336(line=16, offs=22) -- 341(line=16, offs=27) */ ATSINSmove(tmp7, atspre_g0int_mod_int(arg1, ATSPMVi0nt(2))) ; @@ -541,23 +511,23 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 328(line=17, offs=16) -- 334(line=17, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 370(line=18, offs=16) -- 376(line=18, offs=22) */ ATSINSmove(tmp8, ATSLIB_056_prelude__eq_g0int_int__7__1(tmp7, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 325(line=17, offs=13) -- 418(line=20, offs=33)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 367(line=18, offs=13) -- 460(line=21, offs=33) */ ATSif( tmp8 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 358(line=18, offs=19) -- 363(line=18, offs=24)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 400(line=19, offs=19) -- 405(line=19, offs=24) */ ATSINSmove(tmp13, atspre_g0int_mul_int(arg0, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 354(line=18, offs=15) -- 368(line=18, offs=29)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 396(line=19, offs=15) -- 410(line=19, offs=29) */ ATStailcal_beg() ATSINSmove_tlcal(apy0, tmp13) ;@@ -569,30 +539,30 @@ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 408(line=20, offs=23) -- 413(line=20, offs=28)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 450(line=21, offs=23) -- 455(line=21, offs=28) */ ATSINSmove(tmp15, atspre_g0int_mul_int(arg0, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 404(line=20, offs=19) -- 418(line=20, offs=33)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 446(line=21, offs=19) -- 460(line=21, offs=33) */ ATSINSmove(tmp14, exp_0(tmp15, tmp6)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 400(line=20, offs=15) -- 418(line=20, offs=33)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 442(line=21, offs=15) -- 460(line=21, offs=33) */ ATSINSmove(tmpret0, atspre_g0int_mul_int(arg0, tmp14)) ; } /* ATSendif */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 240(line=13, offs=11) -- 432(line=21, offs=14)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 282(line=14, offs=11) -- 474(line=22, offs=14) */ /* INSletpop() */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 456(line=23, offs=11) -- 457(line=23, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 498(line=24, offs=11) -- 499(line=24, offs=12) */ ATSINSmove(tmpret0, ATSPMVi0nt(1)) ; } /* ATSendif */@@ -776,122 +746,109 @@ } /* end of [ATSLIB_056_prelude__eq_g0int_int__7__1] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 473(line=26, offs=5) -- 778(line=35, offs=6)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 515(line=27, offs=5) -- 718(line=33, offs=6) */ /* local: -global: sqrt_bad_12$0(level=0)+global: sqrt_int_12$0(level=0) local: global: */ ATSstatic() atstkind_t0ype(atstype_int)-sqrt_bad_12(atstkind_t0ype(atstype_int) arg0)+sqrt_int_12(atstkind_t0ype(atstype_int) arg0) { /* tmpvardeclst(beg) */ ATStmpdec(tmpret16, atstkind_t0ype(atstype_int)) ; ATStmpdec(tmpref17, atstkind_t0ype(atstype_int)) ; ATStmpdec(tmp18, atstkind_t0ype(atstype_float)) ; ATStmpdec(tmp19, atstkind_t0ype(atstype_float)) ;-ATStmpdec(tmpref20, atstyclo_type(__patsfun_14)) ;-ATStmpdec(tmpref24, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpref20, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 473(line=26, offs=5) -- 778(line=35, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 515(line=27, offs=5) -- 718(line=33, offs=6) */-ATSINSflab(__patsflab_sqrt_bad_12):+ATSINSflab(__patsflab_sqrt_int_12): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 521(line=27, offs=3) -- 778(line=35, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 563(line=28, offs=3) -- 718(line=33, offs=6) */ /* letpush(beg) */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 533(line=28, offs=9) -- 542(line=28, offs=18)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 575(line=29, offs=9) -- 584(line=29, offs=18) */ /* ATSINStmpdec(tmpref17) ; */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 573(line=28, offs=49) -- 596(line=28, offs=72)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 615(line=29, offs=49) -- 638(line=29, offs=72) */ ATSINSmove(tmp19, atspre_g0int2float_int_float(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 562(line=28, offs=38) -- 598(line=28, offs=74)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 604(line=29, offs=38) -- 640(line=29, offs=74) */ ATSINSmove(tmp18, atslib_libats_libc_sqrt_float(tmp19)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 550(line=28, offs=26) -- 599(line=28, offs=75)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 592(line=29, offs=26) -- 641(line=29, offs=75) */ ATSINSmove(tmpref17, atspre_g0float2int_float_int(tmp18)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 608(line=29, offs=9) -- 611(line=29, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 650(line=30, offs=9) -- 655(line=30, offs=14) */ /* ATSINStmpdec(tmpref20) ; */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 614(line=29, offs=15) -- 706(line=31, offs=26)-*/-ATSINSclosure_initize(__patsfun_14, ((__patsfun_14__closure_t0ype*)(&tmpref20))) ;-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 715(line=32, offs=9) -- 720(line=32, offs=14)-*/-/*-ATSINStmpdec(tmpref24) ;-*/-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 743(line=32, offs=37) -- 756(line=32, offs=50)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 678(line=30, offs=37) -- 696(line=30, offs=55) */-ATSINSmove(tmpref24, ATSfunclo_clo(ATSPMVrefarg1(ATSPMVptrof(tmpref20)), (atstype_cloptr, atstkind_t0ype(atstype_int)), atstkind_t0ype(atstype_int))(ATSPMVrefarg1(ATSPMVptrof(tmpref20)), tmpref17)) ;-+ATSINSmove(tmpref20, ATSPMVcastfn(cast, atstkind_t0ype(atstype_int), tmpref17)) ; /* letpush(end) */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 767(line=34, offs=5) -- 772(line=34, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 707(line=32, offs=5) -- 712(line=32, offs=10) */-ATSINSmove(tmpret16, tmpref24) ;+ATSINSmove(tmpret16, tmpref20) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 521(line=27, offs=3) -- 778(line=35, offs=6)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 563(line=28, offs=3) -- 718(line=33, offs=6) */ /* INSletpop() */ ATSfunbody_end() ATSreturn(tmpret16) ;-} /* end of [sqrt_bad_12] */+} /* end of [sqrt_int_12] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 614(line=29, offs=15) -- 706(line=31, offs=26)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 723(line=35, offs=4) -- 1306(line=58, offs=10) */ /*-local: __patsfun_14$0(level=1)-global: __patsfun_14$0(level=1)+local: sqrt_int_12$0(level=0)+global: sqrt_int_12$0(level=0), is_prime_14$0(level=0) local: global: */ ATSstatic()-atstkind_t0ype(atstype_int)-__patsfun_14(atstkind_t0ype(atstype_int) arg0)+atstkind_t0ype(atstype_bool)+is_prime_14(atstkind_t0ype(atstype_int) arg0) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret21, atstkind_t0ype(atstype_int)) ;-ATStmpdec(tmp22, atstkind_t0ype(atstype_int)) ;-ATStmpdec(tmp23, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpret21, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp42, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 614(line=29, offs=15) -- 706(line=31, offs=26)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 723(line=35, offs=4) -- 1306(line=58, offs=10) */-ATSINSflab(__patsflab___patsfun_14):+ATSINSflab(__patsflab_is_prime_14): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 655(line=29, offs=56) -- 706(line=31, offs=26)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 757(line=36, offs=3) -- 1306(line=58, offs=10) */ ATScaseof_beg() /*@@ -899,15 +856,15 @@ */ ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 674(line=30, offs=9) -- 675(line=30, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 774(line=37, offs=7) -- 775(line=37, offs=8) */ ATSINSlab(__atstmplab3): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 622(line=29, offs=23) -- 623(line=29, offs=24)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 732(line=35, offs=13) -- 733(line=35, offs=14) */-ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(0))) { ATSINSgoto(__atstmplab5) ; } ;+ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab5) ; } ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 675(line=30, offs=10) -- 675(line=30, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 775(line=37, offs=8) -- 775(line=37, offs=8) */ ATSINSlab(__atstmplab4): /*@@ -917,14 +874,14 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 679(line=30, offs=14) -- 680(line=30, offs=15)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 779(line=37, offs=12) -- 784(line=37, offs=17) */-ATSINSmove(tmpret21, ATSPMVi0nt(0)) ;+ATSINSmove(tmpret21, ATSPMVbool_false()) ; ATSbranch_end() ATSbranch_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 690(line=31, offs=10) -- 690(line=31, offs=10)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 792(line=38, offs=8) -- 792(line=38, offs=8) */ ATSINSlab(__atstmplab5): /*@@ -934,98 +891,7 @@ ibranch-mbody: */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 700(line=31, offs=20) -- 705(line=31, offs=25)-*/-ATSINSmove(tmp23, atspre_g0int_sub_int(arg0, ATSPMVi0nt(1))) ;--/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 698(line=31, offs=18) -- 706(line=31, offs=26)-*/-ATSINSmove(tmp22, __patsfun_14(tmp23)) ;--/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 694(line=31, offs=14) -- 706(line=31, offs=26)-*/-ATSINSmove(tmpret21, atspre_g1int_add_int(ATSPMVi0nt(1), tmp22)) ;--ATSbranch_end()--/*-** ibranchlst-end-*/-ATScaseof_end()--ATSfunbody_end()-ATSreturn(tmpret21) ;-} /* end of [__patsfun_14] */--/*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 784(line=37, offs=5) -- 1375(line=60, offs=10)-*/-/*-local: sqrt_bad_12$0(level=0)-global: sqrt_bad_12$0(level=0), is_prime_17$0(level=0)-local: -global: -*/-ATSstatic()-atstkind_t0ype(atstype_bool)-is_prime_17(atstkind_t0ype(atstype_int) arg0)-{-/* tmpvardeclst(beg) */-ATStmpdec(tmpret25, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp46, atstkind_t0ype(atstype_int)) ;-/* tmpvardeclst(end) */-ATSfunbody_beg()-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 784(line=37, offs=5) -- 1375(line=60, offs=10)-*/-ATSINSflab(__patsflab_is_prime_17):-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 818(line=38, offs=3) -- 1375(line=60, offs=10)-*/-ATScaseof_beg()-/*-** ibranchlst-beg-*/-ATSbranch_beg()-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 835(line=39, offs=7) -- 836(line=39, offs=8)-*/-ATSINSlab(__atstmplab6):-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 793(line=37, offs=14) -- 794(line=37, offs=15)-*/-ATSifnthen(ATSCKpat_int(arg0, ATSPMVint(1))) { ATSINSgoto(__atstmplab8) ; } ;-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 836(line=39, offs=8) -- 836(line=39, offs=8)-*/-ATSINSlab(__atstmplab7):-/*-emit_instr: loc0 = : 0(line=0, offs=0) -- 0(line=0, offs=0)-*/-/*-ibranch-mbody:-*/-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 840(line=39, offs=12) -- 845(line=39, offs=17)-*/-ATSINSmove(tmpret25, ATSPMVbool_false()) ;-ATSbranch_end()--ATSbranch_beg()-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 853(line=40, offs=8) -- 853(line=40, offs=8)-*/-ATSINSlab(__atstmplab8):-/*-emit_instr: loc0 = : 0(line=0, offs=0) -- 0(line=0, offs=0)-*/-/*-ibranch-mbody:-*/-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 878(line=42, offs=9) -- 1365(line=59, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 817(line=40, offs=9) -- 1296(line=57, offs=12) */ /* letpush(beg)@@ -1035,17 +901,17 @@ */ /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1341(line=58, offs=19) -- 1351(line=58, offs=29)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1272(line=56, offs=19) -- 1282(line=56, offs=29) */-ATSINSmove(tmp46, sqrt_bad_12(arg0)) ;+ATSINSmove(tmp42, sqrt_int_12(arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1333(line=58, offs=11) -- 1353(line=58, offs=31)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1264(line=56, offs=11) -- 1284(line=56, offs=31) */-ATSINSmove(tmpret25, loop_18(arg0, ATSPMVi0nt(2), tmp46)) ;+ATSINSmove(tmpret21, loop_15(arg0, ATSPMVi0nt(2), tmp42)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 878(line=42, offs=9) -- 1365(line=59, offs=12)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 817(line=40, offs=9) -- 1296(line=57, offs=12) */ /* INSletpop()@@ -1058,148 +924,136 @@ ATScaseof_end() ATSfunbody_end()-ATSreturn(tmpret25) ;-} /* end of [is_prime_17] */+ATSreturn(tmpret21) ;+} /* end of [is_prime_14] */ /*-/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 896(line=43, offs=15) -- 1311(line=56, offs=21)+/home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 835(line=41, offs=15) -- 1242(line=54, offs=21) */ /*-local: loop_18$0(level=1)-global: loop_18$0(level=1)-local: k$4743(1)(HSEapp(HSEcst(atstkind_t0ype); HSEs2exp(S2Eextkind(atstype_int))))-global: k$4743(1)(HSEapp(HSEcst(atstkind_t0ype); HSEs2exp(S2Eextkind(atstype_int))))+local: loop_15$0(level=1)+global: loop_15$0(level=1)+local: k$4739(1)(HSEapp(HSEcst(atstkind_t0ype); HSEs2exp(S2Eextkind(atstype_int))))+global: k$4739(1)(HSEapp(HSEcst(atstkind_t0ype); HSEs2exp(S2Eextkind(atstype_int)))) */ ATSstatic() atstkind_t0ype(atstype_bool)-loop_18(atstkind_t0ype(atstype_int) env0, atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1)+loop_15(atstkind_t0ype(atstype_int) env0, atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */ ATStmpdec(apy0, atstkind_t0ype(atstype_int)) ; ATStmpdec(apy1, atstkind_t0ype(atstype_int)) ;-ATStmpdec(tmpret26, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp27, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp32, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp35, atstkind_t0ype(atstype_int)) ;-ATStmpdec(tmp36, atstkind_t0ype(atstype_int)) ;-ATStmpdec(tmp37, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp42, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp45, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpret22, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp23, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp28, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp31, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmp32, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmp33, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp38, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp41, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 896(line=43, offs=15) -- 1311(line=56, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 835(line=41, offs=15) -- 1242(line=54, offs=21) */-ATSINSflab(__patsflab_loop_18):+ATSINSflab(__patsflab_loop_15): /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 990(line=44, offs=16) -- 999(line=44, offs=25)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 929(line=42, offs=16) -- 938(line=42, offs=25) */-ATSINSmove(tmp27, ATSLIB_056_prelude__lt_g1int_int__19__1(arg0, arg1)) ;+ATSINSmove(tmp23, ATSLIB_056_prelude__lt_g1int_int__16__1(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 987(line=44, offs=13) -- 1311(line=56, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 926(line=42, offs=13) -- 1242(line=54, offs=21) */ ATSif(-tmp27+tmp23 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1022(line=45, offs=18) -- 1027(line=45, offs=23)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 961(line=43, offs=18) -- 966(line=43, offs=23) */-ATSINSmove(tmp35, atspre_g0int_mod_int(env0, arg0)) ;+ATSINSmove(tmp31, atspre_g0int_mod_int(env0, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1022(line=45, offs=18) -- 1031(line=45, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 961(line=43, offs=18) -- 970(line=43, offs=27) */-ATSINSmove(tmp32, ATSLIB_056_prelude__eq_g0int_int__7__2(tmp35, ATSPMVi0nt(0))) ;+ATSINSmove(tmp28, ATSLIB_056_prelude__eq_g0int_int__7__2(tmp31, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1019(line=45, offs=15) -- 1120(line=48, offs=43)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 958(line=43, offs=15) -- 1051(line=46, offs=35) */ ATSif(-tmp32+tmp28 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1053(line=46, offs=17) -- 1058(line=46, offs=22)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 992(line=44, offs=17) -- 997(line=44, offs=22) */-ATSINSmove(tmpret26, ATSPMVbool_false()) ;+ATSINSmove(tmpret22, ATSPMVbool_false()) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1094(line=48, offs=17) -- 1120(line=48, offs=43)-*/-ATSif(-ATSPMVbool_true()-) ATSthen() {-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1094(line=48, offs=17) -- 1120(line=48, offs=43)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1038(line=46, offs=22) -- 1043(line=46, offs=27) */-ATSINSmove(tmp36, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ;+ATSINSmove(tmp32, atspre_g1int_add_int(arg0, ATSPMVi0nt(1))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1094(line=48, offs=17) -- 1120(line=48, offs=43)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1033(line=46, offs=17) -- 1051(line=46, offs=35) */ ATStailcal_beg()-ATSINSmove_tlcal(apy0, tmp36) ;+ATSINSmove_tlcal(apy0, tmp32) ; ATSINSmove_tlcal(apy1, arg1) ; ATSINSargmove_tlcal(arg0, apy0) ; ATSINSargmove_tlcal(arg1, apy1) ;-ATSINSfgoto(__patsflab_loop_18) ;+ATSINSfgoto(__patsflab_loop_15) ; ATStailcal_end() -} ATSelse() {-/*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1094(line=48, offs=17) -- 1120(line=48, offs=43)-*/-ATSINSmove(tmpret26, ATSPMVbool_false()) ; } /* ATSendif */-} /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1155(line=50, offs=18) -- 1164(line=50, offs=27)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1086(line=48, offs=18) -- 1095(line=48, offs=27) */-ATSINSmove(tmp37, ATSLIB_056_prelude__eq_g1int_int__23__1(arg0, arg1)) ;+ATSINSmove(tmp33, ATSLIB_056_prelude__eq_g1int_int__21__1(arg0, arg1)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1152(line=50, offs=15) -- 1311(line=56, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1083(line=48, offs=15) -- 1242(line=54, offs=21) */ ATSif(-tmp37+tmp33 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1189(line=51, offs=20) -- 1194(line=51, offs=25)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1120(line=49, offs=20) -- 1125(line=49, offs=25) */-ATSINSmove(tmp45, atspre_g0int_mod_int(env0, arg0)) ;+ATSINSmove(tmp41, atspre_g0int_mod_int(env0, arg0)) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1189(line=51, offs=20) -- 1198(line=51, offs=29)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1120(line=49, offs=20) -- 1129(line=49, offs=29) */-ATSINSmove(tmp42, ATSLIB_056_prelude__eq_g0int_int__7__3(tmp45, ATSPMVi0nt(0))) ;+ATSINSmove(tmp38, ATSLIB_056_prelude__eq_g0int_int__7__3(tmp41, ATSPMVi0nt(0))) ; /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1186(line=51, offs=17) -- 1271(line=54, offs=23)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1117(line=49, offs=17) -- 1202(line=52, offs=23) */ ATSif(-tmp42+tmp38 ) ATSthen() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1222(line=52, offs=19) -- 1227(line=52, offs=24)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1153(line=50, offs=19) -- 1158(line=50, offs=24) */-ATSINSmove(tmpret26, ATSPMVbool_false()) ;+ATSINSmove(tmpret22, ATSPMVbool_false()) ; } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1267(line=54, offs=19) -- 1271(line=54, offs=23)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1198(line=52, offs=19) -- 1202(line=52, offs=23) */-ATSINSmove(tmpret26, ATSPMVbool_true()) ;+ATSINSmove(tmpret22, ATSPMVbool_true()) ; } /* ATSendif */ } ATSelse() { /*-emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1307(line=56, offs=17) -- 1311(line=56, offs=21)+emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics.dats: 1238(line=54, offs=17) -- 1242(line=54, offs=21) */-ATSINSmove(tmpret26, ATSPMVbool_true()) ;+ATSINSmove(tmpret22, ATSPMVbool_true()) ; } /* ATSendif */ } /* ATSendif */ ATSfunbody_end()-ATSreturn(tmpret26) ;-} /* end of [loop_18] */+ATSreturn(tmpret22) ;+} /* end of [loop_15] */ #if(0) /*@@ -1207,7 +1061,7 @@ */ /* local: -global: lt_g1int_int$19$0(level=0)+global: lt_g1int_int$16$0(level=0) local: global: */@@ -1218,11 +1072,11 @@ tmpsub = None() */ atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__lt_g1int_int__19(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1)+ATSLIB_056_prelude__lt_g1int_int__16(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret28, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp29, atstkind_t0ype(atstyvar_type(tk))) ;+ATStmpdec(tmpret24, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp25, atstkind_t0ype(atstyvar_type(tk))) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1232,16 +1086,16 @@ /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12546(line=650, offs=29) -- 12557(line=650, offs=40) */-ATSINSmove(tmp29, PMVtmpltcst(g1int2int<S2Eextkind(atstype_int), S2Evar(tk(4697))>)(arg1)) ;+ATSINSmove(tmp25, PMVtmpltcst(g1int2int<S2Eextkind(atstype_int), S2Evar(tk(4697))>)(arg1)) ; /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12529(line=650, offs=12) -- 12559(line=650, offs=42) */-ATSINSmove(tmpret28, PMVtmpltcst(g1int_lt<S2Evar(tk(4697))>)(arg0, tmp29)) ;+ATSINSmove(tmpret24, PMVtmpltcst(g1int_lt<S2Evar(tk(4697))>)(arg0, tmp25)) ; ATSfunbody_end()-ATSreturn(tmpret28) ;-} /* end of [ATSLIB_056_prelude__lt_g1int_int__19] */+ATSreturn(tmpret24) ;+} /* end of [ATSLIB_056_prelude__lt_g1int_int__16] */ #endif // end of [TEMPLATE] /*@@ -1249,7 +1103,7 @@ */ /* local: -global: lt_g1int_int$19$1(level=2)+global: lt_g1int_int$16$1(level=2) local: global: */@@ -1260,11 +1114,11 @@ tmpsub = Some(tk(4697) -> S2Eextkind(atstype_int)) */ atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__lt_g1int_int__19__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1)+ATSLIB_056_prelude__lt_g1int_int__16__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret28__1, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp29__1, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpret24__1, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp25__1, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1274,16 +1128,16 @@ /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12546(line=650, offs=29) -- 12557(line=650, offs=40) */-ATSINSmove(tmp29__1, atspre_g1int2int_int_int(arg1)) ;+ATSINSmove(tmp25__1, atspre_g1int2int_int_int(arg1)) ; /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12529(line=650, offs=12) -- 12559(line=650, offs=42) */-ATSINSmove(tmpret28__1, atspre_g1int_lt_int(arg0, tmp29__1)) ;+ATSINSmove(tmpret24__1, atspre_g1int_lt_int(arg0, tmp25__1)) ; ATSfunbody_end()-ATSreturn(tmpret28__1) ;-} /* end of [ATSLIB_056_prelude__lt_g1int_int__19__1] */+ATSreturn(tmpret24__1) ;+} /* end of [ATSLIB_056_prelude__lt_g1int_int__16__1] */ /* /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42)@@ -1332,7 +1186,7 @@ */ /* local: -global: eq_g1int_int$23$0(level=0)+global: eq_g1int_int$21$0(level=0) local: global: */@@ -1343,11 +1197,11 @@ tmpsub = None() */ atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__eq_g1int_int__23(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1)+ATSLIB_056_prelude__eq_g1int_int__21(atstkind_t0ype(atstyvar_type(tk)) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret38, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp39, atstkind_t0ype(atstyvar_type(tk))) ;+ATStmpdec(tmpret34, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp35, atstkind_t0ype(atstyvar_type(tk))) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1357,16 +1211,16 @@ /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12864(line=668, offs=29) -- 12875(line=668, offs=40) */-ATSINSmove(tmp39, PMVtmpltcst(g1int2int<S2Eextkind(atstype_int), S2Evar(tk(4709))>)(arg1)) ;+ATSINSmove(tmp35, PMVtmpltcst(g1int2int<S2Eextkind(atstype_int), S2Evar(tk(4709))>)(arg1)) ; /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12847(line=668, offs=12) -- 12877(line=668, offs=42) */-ATSINSmove(tmpret38, PMVtmpltcst(g1int_eq<S2Evar(tk(4709))>)(arg0, tmp39)) ;+ATSINSmove(tmpret34, PMVtmpltcst(g1int_eq<S2Evar(tk(4709))>)(arg0, tmp35)) ; ATSfunbody_end()-ATSreturn(tmpret38) ;-} /* end of [ATSLIB_056_prelude__eq_g1int_int__23] */+ATSreturn(tmpret34) ;+} /* end of [ATSLIB_056_prelude__eq_g1int_int__21] */ #endif // end of [TEMPLATE] /*@@ -1374,7 +1228,7 @@ */ /* local: -global: eq_g1int_int$23$1(level=2)+global: eq_g1int_int$21$1(level=2) local: global: */@@ -1385,11 +1239,11 @@ tmpsub = Some(tk(4709) -> S2Eextkind(atstype_int)) */ atstkind_t0ype(atstype_bool)-ATSLIB_056_prelude__eq_g1int_int__23__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1)+ATSLIB_056_prelude__eq_g1int_int__21__1(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret38__1, atstkind_t0ype(atstype_bool)) ;-ATStmpdec(tmp39__1, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpret34__1, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmp35__1, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1399,16 +1253,16 @@ /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12864(line=668, offs=29) -- 12875(line=668, offs=40) */-ATSINSmove(tmp39__1, atspre_g1int2int_int_int(arg1)) ;+ATSINSmove(tmp35__1, atspre_g1int2int_int_int(arg1)) ; /* emit_instr: loc0 = /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats({$PATSPRE}/DATS/integer.dats): 12847(line=668, offs=12) -- 12877(line=668, offs=42) */-ATSINSmove(tmpret38__1, atspre_g1int_eq_int(arg0, tmp39__1)) ;+ATSINSmove(tmpret34__1, atspre_g1int_eq_int(arg0, tmp35__1)) ; ATSfunbody_end()-ATSreturn(tmpret38__1) ;-} /* end of [ATSLIB_056_prelude__eq_g1int_int__23__1] */+ATSreturn(tmpret34__1) ;+} /* end of [ATSLIB_056_prelude__eq_g1int_int__21__1] */ /* /usr/local/lib/ats2-postiats-0.3.8/prelude/DATS/integer.dats: 12259(line=635, offs=3) -- 12298(line=635, offs=42)@@ -1455,8 +1309,8 @@ /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics-ffi.dats: 269(line=14, offs=24) -- 287(line=15, offs=13) */ /*-local: is_prime_17$0(level=0)-global: sqrt_bad_12$0(level=0), is_prime_17$0(level=0), is_prime_ats$27$0(level=0)+local: is_prime_14$0(level=0)+global: sqrt_int_12$0(level=0), is_prime_14$0(level=0), is_prime_ats$25$0(level=0) local: global: */@@ -1465,7 +1319,7 @@ is_prime_ats(atstkind_t0ype(atstype_int) arg0) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret47, atstkind_t0ype(atstype_bool)) ;+ATStmpdec(tmpret43, atstkind_t0ype(atstype_bool)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1475,10 +1329,10 @@ /* emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics-ffi.dats: 277(line=15, offs=3) -- 287(line=15, offs=13) */-ATSINSmove(tmpret47, is_prime_17(arg0)) ;+ATSINSmove(tmpret43, is_prime_14(arg0)) ; ATSfunbody_end()-ATSreturn(tmpret47) ;+ATSreturn(tmpret43) ; } /* end of [is_prime_ats] */ /*@@ -1486,7 +1340,7 @@ */ /* local: exp_0$0(level=0)-global: exp_0$0(level=0), exp_ats$28$0(level=0)+global: exp_0$0(level=0), exp_ats$26$0(level=0) local: global: */@@ -1495,7 +1349,7 @@ exp_ats(atstkind_t0ype(atstype_int) arg0, atstkind_t0ype(atstype_int) arg1) { /* tmpvardeclst(beg) */-ATStmpdec(tmpret48, atstkind_t0ype(atstype_int)) ;+ATStmpdec(tmpret44, atstkind_t0ype(atstype_int)) ; /* tmpvardeclst(end) */ ATSfunbody_beg() /*@@ -1505,10 +1359,10 @@ /* emit_instr: loc0 = /home/vanessa/programming/haskell/current/fast-combinatorics/ats-src/numerics-ffi.dats: 319(line=18, offs=3) -- 328(line=18, offs=12) */-ATSINSmove(tmpret48, exp_0(arg0, arg1)) ;+ATSINSmove(tmpret44, exp_0(arg0, arg1)) ; ATSfunbody_end()-ATSreturn(tmpret48) ;+ATSreturn(tmpret44) ; } /* end of [exp_ats] */ /*@@ -1536,6 +1390,9 @@ /* dynexnlst-initize(end) */+/* local */+/* in of [local] */+/* end of [local] */ } /* ATSendif */ ATSfunbody_end() ATSreturn_void(tmpret_void) ;
fast-combinatorics.cabal view
@@ -1,5 +1,5 @@ name: fast-combinatorics-version: 0.1.0.6+version: 0.1.0.7 synopsis: Fast combinatorics. description: Fast combinatorics code with a high level of safety guaranteed by writing it in ATS. homepage: https://github.com//fast-combinatorics#readme@@ -37,6 +37,8 @@ library c-sources: cbits/combinatorics-ffi.c , cbits/numerics-ffi.c+ include-dirs: /usr/local/lib/ats2-postiats-0.3.8/ccomp/runtime/+ , /usr/local/lib/ats2-postiats-0.3.8/ include-dirs: ATS2-Postiats-include-0.3.8/ccomp/runtime/ , ATS2-Postiats-include-0.3.8/ hs-source-dirs: src@@ -49,7 +51,7 @@ if flag(development) ghc-options: -Werror if impl(ghc >= 8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat + ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat ghc-options: -Wall -optc-mtune=native -optc-flto -optc-O3 test-suite fast-combinatorics-test@@ -77,7 +79,7 @@ ghc-options: -Werror if impl(ghc >= 8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat - ghc-options: -Wall -optc-mtune=native -optc-flto -optc-O3+ ghc-options: -Wall default-language: Haskell2010 source-repository head
src/Numeric/Combinatorics.hs view
@@ -20,8 +20,11 @@ foreign import ccall unsafe choose_ats :: CInt -> CInt -> CInt foreign import ccall unsafe double_factorial :: CInt -> CInt --- | See [here](http://mathworld.wolfram.com/BinomialCoefficient.html).-choose :: Int -> Int -> Int+-- | Number of distinct sets of k objects drawn from a set of n distinct+-- objects. See [here](http://mathworld.wolfram.com/BinomialCoefficient.html).+choose :: Int -- ^ n+ -> Int -- ^ k+ -> Int choose = fromIntegral .* on choose_ats fromIntegral -- | See [here](http://mathworld.wolfram.com/DoubleFactorial.html).
src/Numeric/Pure/Combinatorics.hs view
@@ -1,5 +1,6 @@ module Numeric.Pure.Combinatorics ( hsIsPrime , hsFactorial+ , hsDoubleFactorial , hsChoose ) where @@ -11,6 +12,11 @@ hsFactorial :: Int -> Int hsFactorial 0 = 1 hsFactorial n = n * hsFactorial (n-1)++hsDoubleFactorial :: Int -> Int+hsDoubleFactorial 0 = 1+hsDoubleFactorial 1 = 1+hsDoubleFactorial k = k * hsDoubleFactorial (k-2) hsChoose :: Int -> Int -> Int hsChoose n k = product [ n + 1 - i | i <- [1..k] ] `div` hsFactorial k
test/Spec.hs view
@@ -15,6 +15,9 @@ parallel $ describe "factorial" $ prop "should agree with the pure Haskell function" $ \x -> x < 1 || x > 12 || factorial x == hsFactorial x+ parallel $ describe "doubleFactorial" $+ prop "should agree with the pure Haskell function" $+ \x -> x < 0 || x > 19 || doubleFactorial x == hsDoubleFactorial x parallel $ describe "choose" $ prop "should agree with the pure Haskell function" $ \x y -> x < 0 || y < 0 || x > 13 || y > 11 || (x `choose` y) == (x `hsChoose` y)