Skip to content

Instantly share code, notes, and snippets.

@enolan
Created October 14, 2009 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enolan/210453 to your computer and use it in GitHub Desktop.
Save enolan/210453 to your computer and use it in GitHub Desktop.
Tue Oct 6 16:59:24 PDT 2009 Echo Nolan <echo@echonolan.net>
* Fix Iter.take delaying actions one step.
It was broken in two maddeninly subtle ways. The first: using joinIM delayed
all actions associated with take's parameter iteratee one step. The second:
it always returned Cont when the length of the chunk was <= the requested
length and non-null. Thus, the values returned were one step delayed if the
amount to take was equal to the length of the chunk passed.
New patches:
[Fix Iter.take delaying actions one step.
Echo Nolan <echo@echonolan.net>**20091006235924
Ignore-this: 2aa35f357f778727c2cc6c90e9cabd62
It was broken in two maddeninly subtle ways. The first: using joinIM delayed
all actions associated with take's parameter iteratee one step. The second:
it always returned Cont when the length of the chunk was <= the requested
length and non-null. Thus, the values returned were one step delayed if the
amount to take was equal to the length of the chunk passed.
] hunk ./src/Data/Iteratee/Base.hs 477
where
step n chk@(Chunk str)
| SC.null str = return $ Cont (take n iter) Nothing
- | SC.length str <= n = return $ Cont (joinIM inner) Nothing
+ | SC.length str < n = liftM (flip Cont Nothing) inner
where inner = liftM (check (n - SC.length str)) (runIter iter chk)
step n (Chunk str) = done (Chunk s1) (Chunk s2)
where (s1, s2) = SC.splitAt n str
Context:
[add sum and product.
jwlato@gmail.com**20090921230901
Ignore-this: 1dd15d532931955e938f887264682ac0
]
[enumFd: change buffer size to 4096
jwlato@gmail.com**20090919233300
Ignore-this: 7225a88ede05df15f802244fade199b7
]
[Base.foldl': inline and minor changes.
jwlato@gmail.com**20090919233227
Ignore-this: acd6f55b932070c526f1000f9d3e5edd
]
[improve comments in Examples/headers.hs
jwlato@gmail.com**20090916165655
Ignore-this: d5e5018b6007508e81b9f571787c70dc
]
[Base.hs: new foldl definition increases sharing
jwlato@gmail.com**20090818170143
Ignore-this: 623756a91e7cf5d28e528494434afcf1
Measurably more efficient for general use.
]
[add rigidMap and looseMap
jwlato@gmail.com**20090811220245
Ignore-this: 89152bccaea378dcd813a8278e6ab845
]
[StreamChunk.hs -- fix type of cMap
jwlato@gmail.com**20090806100223
Ignore-this: f45233ed959ebc8ea8ceb67b6d518e97
]
[make the default fileDrivers polymorphic over monads
jwlato@gmail.com**20090731182923
Ignore-this: b5807b6b8a52b9d4a72408b21b292d81
]
[update IO.Fd to use the new enum* design
jwlato@gmail.com**20090731182842
Ignore-this: d2c8d0e4f0d85e6591d71fb06de4967
]
[minor code cleanup
jwlato@gmail.com**20090731131856
Ignore-this: 66d6f3c327a79b5c5354e818d1cf62ac
]
[new implementation of Handle enumerators
jwlato@gmail.com**20090731131456
Ignore-this: 8f788394c268d0ff785dee4ae6d5b110
Previously, Handle enumerators would only work in the IO monad. This
required users to frequently re-implement handle-based enumerators.
The new design is polymorphic over any MonadIO intance, allowing for
much greater flexibility. Performance is generally similar to the
old implementation. In addition to passing the test suite, this
implementation works properly for the iter-audio driver, which requires
both random IO and StateT monad stack.
]
[add utilities to build the hpc-enabled test suite.
jwlato@gmail.com**20090731130035
Ignore-this: 111e1c5c0aedd74248d25741952e693f
]
[minor extra documentation/commments
jwlato@gmail.com**20090731124149
Ignore-this: 3ccf212799c0a4b8aafd734fe52fa662
]
[update exported modules
jwlato@gmail.com**20090731124048
Ignore-this: 48c7f4936bbb71c1134cc1f0fe0a306c
Export IO.Windows on Windows
Export IO.Posix and IO.Fd on POSIX
Export IO.Handle everywhere
Hide IO.Base everywhere
]
[add stream2stream
jwlato@gmail.com**20090724101654
Ignore-this: 8a4ce39eb233aabed574dafcb22ffe7e
]
[add liftInner
jwlato@gmail.com**20090724101536
Ignore-this: b8b9f3458de60ea92d7c306520828913
]
[add dropWhile
jwlato@gmail.com**20090719215128
Ignore-this: a14b062f56842b75a0071b447a654524
]
[take hlint suggestions
jwlato@gmail.com**20090704133531
Ignore-this: b4653c55d683305987ee3416e161eed4
]
[update WrappedByteString to lesson dependency on Base.
jwlato@gmail.com**20090701225018
Ignore-this: 73e9c95ab1386dd83a10883b3b9c9dc
]
[update CONTRIBUTORS
jwlato@gmail.com**20090625182015
Ignore-this: 2ac411b93b70ac2afdd02caf77c47724
]
[fix conflicts from merging reformat of .cabal
jwlato@gmail.com**20090625181948
Ignore-this: d5f2eb5b0d66050a1901563fead411cc
]
[Replaced Setup.lhs with Setup.hs.
Brian Lewis <brian@lorf.org>**20090625132654
Ignore-this: 18827dd404c1c1b89118b7324f24c089
]
[Took some hlint suggestions.
Brian Lewis <brian@lorf.org>**20090625132323
Ignore-this: a7f6d36592926f30d16612320de439de
]
[Cleaned up iteratee.cabal.
Brian Lewis <brian@lorf.org>**20090625125537
Ignore-this: f4bad79d1ed57a1d45e2a3eb6ccd6925
]
[Fixed various whitespace issues.
Brian Lewis <brian@lorf.org>**20090625122212
Ignore-this: 78936ed222825a00a1eadad9e2dd8f40
Deleted trailing whitespace and blank lines at the ends of files. Replaced tabs with spaces.
]
[add enumPair combinator
jwlato@gmail.com**20090623135615
Ignore-this: 4962dd3941eda193e2dc1af0baf121ba
]
[TAG 0.2.4
jwlato@gmail.com**20090625112940
Ignore-this: d4fd71e044cf92d5ace7edff39dca38
]
Patch bundle hash:
d1dd857cac6291fef3d312876811bc3e78bb4aef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment