Skip to content
AtomicReps

Navigation

24/30Computer Science

Haskell.

The functional-programming course: types, purity, laziness and type classes.

  • Haskell · 1 of 3

    Types and signatures

    What type does ghci give the Haskell literal 1?

    typescript
    ghci> :type 1
  • Haskell · 2 of 3

    Types and signatures

    In GHC 9.6.7 ghci, what does :type flip (-) 1 print?

  • Haskell · 3 of 3

    Types and signatures

    In ghci, length [1,2,3] has type Int while 1 + 2 has type Num a => a. Why is the first result concrete?

    typescript
    -- 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]        :: Int

Three of the 1,188 Haskell questions.

Keep going with Haskell, free
Next topic · 25/30Networking.