Given [1,2,3], I wrote the following to get [[1],[2],[3]]:

ghci> map return [1,2,3] :: [[Int]]

Is this usage of return idiomatic in Haskell? I'm asking since I could've also used pure instead.


1 Answer 1


I don't see any problem with this. I guess the question could be one of declaring your intent to your reader:

by using return, you very much tell the reader that you are going to work with the list monad;

by using pure you would make them understand your decision in terms of applicative;

by using (:[]), they would simply think that you want to turn a list into a list of singletons.


Not the answer you're looking for? Browse other questions tagged or ask your own question.