In Haskell Turtle, sort has the type (Functor io, MonadIO io, Ord a) => Shell a -> io [a]
. It takes a stream in the form of a Shell monad, sorts it into a list, but then wraps it in a MonadIO
???
This seems counter-intuitive to me. My beginner eyes say that a MonadIO
should only be used when interacting with the outside world, which sort
doesn't need to do.
I would have expected sort
to be (Ord a) => Shell a -> Shell a
so it fits into a stream nicely.
Is this an oversight by the package authors, or am I not understanding how sort
should be used?