
11 Mar
2009
11 Mar
'09
1:59 p.m.
minh thu ha scritto:
[...] The approach I suggested is a bit overkill. You can indeed use L.lines to split the input into lines then work on that.
But still, avoid the pair (Int, Bytestring). Instead, you can basically map on each line the unsafeReadInt modified to : - return the id - return if it is one kind of id or the other kind.
so : type UserId = Int type MovieId = Int unsafeReadInt :: Line -> Either MovieId UserId
Now you have a nice list [Either MovieId UserId] that you need to transform into (MovieId, [UserId]).
Thanks, this seems a much better solution. Manlio