Comment

Comment by consilient

You should generally be writing code against typeclasses, not a particular monad transformer stack. For example:

    fibonacci :: MonadState (Int, Int, Int) m => m Int
    fibonacci = do
        (prev, prev2, n) <- get
        if n > 0 then 
            put (prev + prev2, prev, n - 1) >> fibonacci 
        else
            return prev2

    concreteFib :: ReaderT String (StateT (Int, Int, Int) (ExceptT String Identity)) Int 
    concreteFib = fibonacci
parent consilient 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton