In Haskell, functions are functors and the following code works as expected:
(*3) `fmap` (+100) $ 1
The output is 303 of course. However, in Idris (with fmap -> map), it gives the following error:
Can't find implementation for
Functor (\uv => Integer -> uv)
To me this seems like functions aren't implemented as functors in Idris, at least not like they are in Haskell, but why is that?
Furthermore, what exactly does the type signature (\uv => Integer -> uv)
mean? It looks like some partially applied function, and that's what would be expected from a functor implementation, but the syntax is a bit confusing, specifically what \
which is supposed to be used for a lambda/literal is doing there.
(->) Integer
. Here,(->)
is partially applied, but in\uv => (->) Integer uv
it is fully applied. Both are eta-convertible. – chi(10.0 /) . (10.0 - )
, although that function applied to 10 evaluates toInfinity
.) – chepner10.0 /
not total itself? – corazza