[Haskell-cafe] Type inference doesn't always calculate the most generic type?
fa-ml at ariis.it
Thu May 28 20:54:31 UTC 2015
On Thu, May 28, 2015 at 10:54:38PM +0200, Christophe Delord wrote:
> I'm new here. Sorry if this question has already been asked.
> I have noticed something strange about type inference.
> Prelude> :t abs
> abs :: Num a => a -> a
> Prelude> let mapabs = map abs
> Prelude> :t mapabs
> mapabs :: [Integer] -> [Integer]
> Prelude> :t (map abs)
> (map abs) :: Num b => [b] -> [b]
I just fired up ghci:
λ> let mapabs = map abs
λ> :t mapabs
mapabs :: Num b => [b] -> [b]
More information about the Haskell-Cafe