..
Haskell Types and Typeclasses
- Difference between
Int
andInteger
Integer
is not bounded
- What is a type class
- Type class specifies a set of methods that when implement for a type would make it eligible to belong to that type class
- What is the class constraint?
- Everything before the
=>
is called as the class constraint - Example:
(==) :: Eq a => a -> a -> Bool
- Everything before the
- What is the input and output type of
compare
- Input is of the type class
Ord
- Output is of the type
Ordering
- Input is of the type class
- What is the
Show
typeclass- Members of this type class can be printed to the screen
- What are enums?
- Sequentially ordered types
- Main advantage of enums?
- They can be enumerated
succ
andpred
can be used to retrieve the surrounding elements
- What is the
Integral
type classInt
andInteger
- What is the
Floating
type classFloat
andDouble
- How to convert from integral types to float?
fromIntegral