Reputation: 103
Is there a generally accepted way of converting a Data.Sequence (Seq a) to a list [a]?
I see there's a fromList, but no toList
Upvotes: 9
Views: 4494
Reputation: 102206
There is a Foldable instance for Seq a, and this provides a toList method. e.g. this will print [1,2,3,4,5,6,7,8,9,10]
Foldable
Seq a
toList
import Data.Foldable (toList) import Data.Sequence (fromList) main = print . toList . fromList $ [1..10]
Upvotes: 20