Merge pull request #4253 from msmorgan/div-mod-precedence
add precedence for infix `div` and `mod`
commit77830c69fb6894070af6acc4dfce858657697e5f
authorAhmad Salim Al-Sibahi <asal@itu.dk>
dateThu 14 Dec 2017, 16:36 (9 years ago)
parentde1d865b95c907
libs/prelude/Prelude/Interfaces.idr+2
@@ -12,6 +12,8 @@ infixl 7 <<, >> -- unused
1212infixl 8 +, -
1313infixl 9 *, /
1414
15+infixl 9 `div`, `mod`
16+
1517-- ------------------------------------------------------------- [ Boolean Ops ]
1618intToBool : Int -> Bool
1719intToBool 0 = False
test/views001/views001.idr+1−1
@@ -26,7 +26,7 @@ mergeSort xs with (splitRec xs)
2626testList : Int -> Int -> List Int -> List Int
2727testList 0 seed acc = acc
2828-- Need to explicitly mod since different back ends overflow differently
29−testList x seed acc = let seed' = seed * 12345 + 768 `mod` 65536 in
29+testList x seed acc = let seed' = (seed * 12345 + 768) `mod` 65536 in
3030 testList (x - 1) seed'
3131 ((seed' `mod` 100) :: acc)
3232
test/views001/views001a.idr+1−1
@@ -13,7 +13,7 @@ mergeSort xs with (splitRec xs)
1313testList : Int -> Int -> List Int -> List Int
1414testList 0 seed acc = acc
1515-- Need to explicitly mod since different back ends overflow differently
16−testList x seed acc = let seed' = seed * 12345 + 768 `mod` 65536 in
16+testList x seed acc = let seed' = (seed * 12345 + 768) `mod` 65536 in
1717 testList (x - 1) seed'
1818 ((seed' `mod` 100) :: acc)
1919
test/views002/views002.idr+1−1
@@ -11,7 +11,7 @@ qsort inp with (filtered (<) inp)
1111testList : Int -> Int -> List Int -> List Int
1212testList 0 seed acc = acc
1313-- Need to explicitly mod since different back ends overflow differently
14−testList x seed acc = let seed' = seed * 12345 + 768 `mod` 65536 in
14+testList x seed acc = let seed' = (seed * 12345 + 768) `mod` 65536 in
1515 testList (x - 1) seed'
1616 ((seed' `mod` 100) :: acc)
1717