Haskell Programming Interview Questions and Answers
Most Frequently Asked Haskell Programming Interview Questions
Q11. Explain the types of Modules used in Haskell
Answer
Total of five types of modules available for Haskell. Here is a short and brief list of them:
- List Module–It provides functions associated with list type data.
- Char Module –Offers predefined functions to work with the character type
- Map Module –It’s an unsorted value-added pair type data type.
- Set Module–Basically used to manipulate mathematical data
- Custom Module –These modules can be called at other programs.
Expertly selected Haskell programming interview questions for experienced
Q12. Explain the difference between Haskell and Erlang?
Answer
S.no | Haskell | Erlang |
---|---|---|
1. | Statically typed functional programming | Dynamically typed functional programming |
2. | The nature of programming is a traditional sand general purpose. | The nature of programming is based on the run-time actor system model. |
3. | Ability to abstract semantics and invariants. | Average outside it niche |
4. | Performs mediocre, rediscover from the scratch | Excellent support for the distributed system |
5. | Categorized as mathematical and academic oriented | Categorized as pragmatic and practical |
Q13. What is Prelude in Haskell
Answer
Prelude is a standard module present in Haskell and is imported by default into every Haskell module unless there is an explicit import statement present in the module or module’s NoImplicitPrelude extension is enabled.
Q14. Explain Haskell data types?
Answer
Q15. What is the purpose of a functor Haskell?
Answer
In Haskell, functions a functional representation of different types which can be mapped over. It’s a high-level concept of implementing polymorphism — the instances of Haskell functorincludes List, Tree, Map, etc.
Q16. How is Haskell different from modern dynamic languages?
Answer
Q17. Difference between `data` and `newtype` in Haskell?
Answer
S.no | Data | new type |
---|---|---|
1. | It declares an entirely new data structure at runtime. | It guarantees that data will have the exact same representation at runtime, as the type programmers wrap. |
2. | It introduces lazy value constructor | It introduces strict value constructor |