From a568e0ccde5a9914512e3d3f5af850b4a652e47f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 12 Aug 2015 14:26:36 +0200 Subject: beuteltier-3.md --- provider/posts/beuteltier-3.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 provider/posts/beuteltier-3.md (limited to 'provider/posts') diff --git a/provider/posts/beuteltier-3.md b/provider/posts/beuteltier-3.md new file mode 100644 index 0000000..79e105a --- /dev/null +++ b/provider/posts/beuteltier-3.md @@ -0,0 +1,19 @@ +--- +title: An Update to the Type Level Utilities of an Overly Complicated Feedreader +published: 2015-08-12 +tags: Beuteltier +--- + +I commited a change to `beuteltier/Beuteltier/Types/Util.hs` ("[…] Hashable update"). I +replaced the `Hashable` instances for `Object` and `MetaData` with a single, better +optimized function: + +~~~ {.haskell .numberLines} +objHash :: Applicative f => ObjectGen f -> f Int +-- ^ Two 'ObjectGen's hashes are a first indication of whether they are 'Equivalent' +objHash o = fmap hash $ (,) <$> (Set.toList . (^. mTags) <$> o ^. oMeta) <*> (Map.keys <$> o ^. oContent) +~~~ + +The new implementation allows computation of hashes without calling `generateObject` (that +function is evil — it makes sure the entire `Object` is "in RAM" (it isn´t actually, of +course (because haskell is lazy)—but I have no guarantee of that)). -- cgit v1.2.3