Haskell · 1 of 3
Types and signatures
What type does ghci give the Haskell literal 1?
ghci> :type 1
AtomicRepsNavigation
The functional-programming course: types, purity, laziness and type classes.
Haskell · 1 of 3
Types and signatures
ghci> :type 1Haskell · 2 of 3
Types and signatures
:type flip (-) 1 print?Haskell · 3 of 3
Types and signatures
length [1,2,3] has type Int while 1 + 2 has type Num a => a. Why is the first result concrete?-- GHC 9.6.7, ghci :type. Literals and the arithmetic over them.1 :: Num a => a1.5 :: Fractional a => a1 + 2 :: Num a => a7 / 2 :: Fractional a => adiv 7 2 :: Integral a => atruncate 3.7 :: Integral b => bfromIntegral (3::Int) :: Num b => blength [1,2,3] :: IntThree of the 1,188 Haskell questions.
Keep going with Haskell, free