..
Haskell Types and Typeclasses
- Difference between
IntandIntegerIntegeris 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
Showtypeclass- 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
succandpredcan be used to retrieve the surrounding elements
- What is the
Integraltype classIntandInteger
- What is the
Floatingtype classFloatandDouble
- How to convert from integral types to float?
fromIntegral