I have been playing around with haskell and I found out that if I write the following function in a code file:
f :: Int -> [a] -> a
f idx str = last $ (take . succ) idx str
then this works totally fine. Naturally, I figured the code would look better without the arguments.
f :: Int -> [a] -> a
f = last $ (take . succ)
But this generates an error when I try to load it into gchi
Couldn't match expected type `[a]'
against inferred type `Int -> [a1] -> [a1]'
In the second argument of `($)', namely `(take . succ)'
In the expression: last $ (take . succ)
In the definition of `f': f = last $ (take . succ)
Failed, modules loaded: none.
I'm kind of confused about how this could be happening...
$by.(this works only in "simple" cases)