HASKELL QUEST
A neon-lit data realm where lambdas hunt monads and types are pure.
You are operative QX-7741. Your mission, should you choose to compile it: traverse 42 quests across the algebraic frontier, unlock the IO sectors, and bind the Maybe nebula.
QUEST GRID
Hexagonal sectors of the algebraic frontier. Hover a node to read intel; click to deploy.
Pure Functions
Bind the lambda. No side effects allowed.
HOLOGRAPHIC TERMINAL
Live challenge harness. Stream input on the left, compile output on the right.
> Quest 07 // The Maybe Nebula
Implement safeDiv :: Int -> Int -> Maybe Int such that
a division by zero returns Nothing and any other input returns
Just the quotient. Bind it through >>= for triple
chained division.
// constraints
- no
error, noundefined - total function, pure
- must compile under
-Wall
// hints
Reach for do-notation only after the kleisli arrow stops smiling at you.
module Quest07 where
safeDiv :: Int -> Int -> Maybe Int
safeDiv _ 0 = Nothing
safeDiv x y = Just (x `div` y)
chain :: Int -> Int -> Int -> Maybe Int
chain a b c =
safeDiv a b >>= \r ->
safeDiv r c
main :: IO ()
main = print (chain 144 12 2)
// stdout will materialize here
OPERATIVE LEADERBOARD
Top compilers in the algebraic frontier. Updated every cycle.
| RANK | OPERATIVE | SECTOR | QUESTS | SCORE |
|---|---|---|---|---|
| 01 | monad.witch | IO/Maybe | 42 | 99,420 |
| 02 | lambda_drift | Functor | 41 | 92,108 |
| 03 | kleisli_kid | Arrow | 40 | 88,776 |
| 04 | foldr_phantom | List | 38 | 81,202 |
| 05 | typevar_t | HKT | 37 | 78,944 |
| 06 | purefn_77 | Lambda | 36 | 74,610 |
| 07 | nullable.io | Maybe | 34 | 70,005 |
| 08 | applicative_x | Applicative | 33 | 66,318 |
| 09 | traverse_v | Traversable | 31 | 61,777 |
| 10 | QX-7741 | YOU | 07 | 14,210 |