It might help to imagine if you flip your arguments:

length [23, 34, 45] / 6 :: Int

How do you represent 3/6 as an Int?

El 17 abr 2020, a las 03:19, Alexander Chen <alexander@chenjia.nl> escribió:

Hi, 


Prelude> :t (/)
(/) :: Fractional a => a -> a -> a

Prelude> :t div
div :: Integral a => a -> a -> a


Prelude> 6 / length [23,34,45]
error 

Prelude> 6 / 3
2.0

Could somebody explain to me why this is?

thanks,

Alexander Chen



_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners