InterviewStack.io LogoInterviewStack.io

Haskell & Functional Programming Concepts Questions

Haskell language fundamentals and functional programming concepts, including pure functions, immutability, higher-order functions, recursion, lazy evaluation, the type system and type classes, and core FP abstractions such as Functor, Applicative, and Monad (including monadic IO), along with common patterns and idioms used in Haskell programming.

MediumTechnical
0 practiced
You are given an imperative algorithm that builds a list of unique elements preserving insertion order using a mutable set and a loop. Implement an idiomatic Haskell function `unique :: (Ord a) => [a] -> [a]` that preserves order using purely functional code (e.g., `foldl` with `Data.Set`). Discuss the time and space trade-offs.
EasyTechnical
0 practiced
Explain what a pure function is and what immutability means in the context of Haskell. Provide two short Haskell examples: one demonstrating a pure function and one showing how an equivalent imperative program would use mutable state. Describe three practical benefits of purity and immutability for testing, reasoning, and concurrency.
HardTechnical
0 practiced
Process a very large file of newline-separated records lazily and with constant memory: using `conduit` or `pipes` (pick one), implement a pipeline that reads a file, parses each line into a record, filters invalid records, and writes JSON output streaming to another file. Describe why streaming avoids memory blowups.
HardTechnical
0 practiced
Implement a simple parser combinator monad from scratch in Haskell (no external libraries). Provide a `Parser a` type, `satisfy` primitive, `char` parser, and implement `Monad` and `Applicative` instances so parsers can be sequenced. Demonstrate parsing a two-digit number.
MediumTechnical
0 practiced
During a code review you find a module that uses `unsafePerformIO` to cache a value and several partial functions like `fromJust`. Explain the risks associated with such code and propose concrete refactorings to make it safer and more maintainable, including how you'd test the refactor.

Unlock Full Question Bank

Get access to hundreds of Haskell & Functional Programming Concepts interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.