Commit db84289c authored by John van Groningen's avatar John van Groningen
Browse files

move function remove_first_n from backendinterface to containers

parent c5407474
...@@ -328,25 +328,7 @@ dictionariesToClasses info type=:{st_args, st_args_strictness, st_arity, st_cont ...@@ -328,25 +328,7 @@ dictionariesToClasses info type=:{st_args, st_args_strictness, st_arity, st_cont
# (reversedTypes, reversedContexts) # (reversedTypes, reversedContexts)
= dictionaryArgsToClasses info st_args ([], []) = dictionaryArgsToClasses info st_args ([], [])
# n_contexts = length reversedContexts # n_contexts = length reversedContexts
# new_st_args_strictness = remove_first_n_strictness_values n_contexts st_args_strictness # new_st_args_strictness = remove_first_n n_contexts st_args_strictness
with
remove_first_n_strictness_values 0 s
= s
remove_first_n_strictness_values _ NotStrict
= NotStrict
remove_first_n_strictness_values n (Strict s)
| n<32
= Strict (((s>>1) bitand 0x7fffffff)>>(n-1))
= NotStrict
remove_first_n_strictness_values n (StrictList s l)
| n<32
# s2=case l of
Strict s -> s
StrictList s _ -> s
NotStrict -> 0
# s=(((s>>1) bitand 0x7fffffff)>>(n-1)) bitor (s2<<(32-n))
= StrictList s (remove_first_n_strictness_values n l)
= remove_first_n_strictness_values (n-32) l
= {type & st_args = reverse reversedTypes, st_context = reverse reversedContexts, = {type & st_args = reverse reversedTypes, st_context = reverse reversedContexts,
st_arity = st_arity - n_contexts, st_args_strictness=new_st_args_strictness} st_arity = st_arity - n_contexts, st_args_strictness=new_st_args_strictness}
......
...@@ -37,6 +37,7 @@ add_next_strict :: !Int !Int !StrictnessList -> (!Int,!Int,!StrictnessList) ...@@ -37,6 +37,7 @@ add_next_strict :: !Int !Int !StrictnessList -> (!Int,!Int,!StrictnessList)
add_next_not_strict :: !Int !Int !StrictnessList -> (!Int,!Int,!StrictnessList) add_next_not_strict :: !Int !Int !StrictnessList -> (!Int,!Int,!StrictnessList)
append_strictness :: !Int !StrictnessList -> StrictnessList append_strictness :: !Int !StrictnessList -> StrictnessList
first_n_are_strict :: !Int !StrictnessList -> Bool first_n_are_strict :: !Int !StrictnessList -> Bool
remove_first_n :: !Int !StrictnessList -> StrictnessList
:: IntKey :== Int :: IntKey :== Int
......
...@@ -351,6 +351,25 @@ first_n_are_strict n (StrictList s l) ...@@ -351,6 +351,25 @@ first_n_are_strict n (StrictList s l)
# m=(1<<n)-1 # m=(1<<n)-1
= s bitand m==m = s bitand m==m
remove_first_n :: !Int !StrictnessList -> StrictnessList
remove_first_n 0 s
= s
remove_first_n _ NotStrict
= NotStrict
remove_first_n n (Strict s)
| n<32
= Strict (((s>>1) bitand 0x7fffffff)>>(n-1))
= NotStrict
remove_first_n n (StrictList s l)
| n<32
# s2=case l of
Strict s -> s
StrictList s _ -> s
NotStrict -> 0
# s=(((s>>1) bitand 0x7fffffff)>>(n-1)) bitor (s2<<(32-n))
= StrictList s (remove_first_n n l)
= remove_first_n (n-32) l
screw :== 80 screw :== 80
:: IntKey :== Int :: IntKey :== Int
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment