[Haskell-cafe] Type inference doesn't always calculate the most generic type?
tikhon at jelv.is
Thu May 28 21:01:50 UTC 2015
The monomorphism restriction is turned off by default in ghci since version
7.8.1, so you'll see this behavior with newer versions of GHC and the
original behavior with older ones.
On Thu, May 28, 2015 at 1:54 PM, Francesco Ariis <fa-ml at ariis.it> wrote:
> On Thu, May 28, 2015 at 10:54:38PM +0200, Christophe Delord wrote:
> > Hello,
> > 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]
> ghc 7.10.1
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe