why Haskell can deduce [] type in this function
- by Sili
rho x = map (((flip mod) x).(\a -> a^2-1)) (rho x)
This function will generate an infinite list. And I tested in GHCi, the function type is
*Main> :t rho
rho :: Integral b => b -> [b]
If I define a function like this
fun x = ((flip mod) x).(\a -> a^2-1)
The type is
*Main> :t fun
fun :: Integral c => c -> c -> c
My question is, how can Haskell deduce the function type to b - [b]? We don't have any [] type data in this function. Thanks!