[Haskell-beginners] weird constraint

Dimitri DeFigueiredo defigueiredo at ucdavis.edu
Wed Jan 16 14:52:47 UTC 2019


Could someone help me make sense of this Num constraint given by GHCi?
I was expecting to get:

inc . const :: Num a => a -> b -> a

rather than:

inc . const :: Num (b -> a) => a -> b -> a

Here's the transcript:


GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
Prelude> inc x = x + 1
Prelude> :t inc
inc :: Num a => a -> a
Prelude> :t const
const :: a -> b -> a
Prelude> :t inc . const
inc . const :: Num (b -> a) => a -> b -> a
Prelude>


Thanks,

Dimitri

-- 
2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F




More information about the Beginners mailing list