
27 Jan
2021
27 Jan
'21
5:48 a.m.
Just a short and probably simple question. Let's consider the following function: collatz n = let coll (n,cpt) | n==1 = (1,cpt) | even n = coll (div n 2,cpt+1) | odd n = coll (div (n*3+1) 2,cpt+1) in snd (coll (n,0)) It is easy to set explicitly the type of "collatz" by writing before the function definition: collatz :: Integer->Int But can I set explicitly the type of the "local" function "coll" ? Thanks