Reputation: 40751
I am trying to walk through the functions in Data.List
of the Haskell stardard library and get an error when trying "permutations". What am I missing here? Thanks.
Prelude> map (\b-> b*b) [1,2,3]
[1,4,9]
Prelude> permutations "abc"
<interactive>:1:0: Not in scope: `permutations'
Upvotes: 1
Views: 737
Reputation: 258298
Data.List.permutations was released in GHC 6.10.1. Chances are you have an earlier version. But if you did have the correct version, you would have to load the Data.List module
like this:
Prelude> :m +Data.List
Prelude Data.List> permutations "abc"
["abc","bac","cba","bca","cab","acb"]
Upvotes: 8
Reputation: 16762
That library page you linked to is for the base libraries version 4 which come with GHC version 6.10. Are you sure you are running GHC 6.10? If you are running the previous version 6.8 then there will not be a permutations function in Data.List.
Upvotes: 4