diff options
-rw-r--r-- | provider/posts/beuteltier-3.md | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
1 | --- | ||
2 | title: An Update to the Type Level Utilities of an Overly Complicated Feedreader | ||
3 | published: 2015-08-12 | ||
4 | tags: Beuteltier | ||
5 | --- | ||
6 | |||
7 | I commited a change to `beuteltier/Beuteltier/Types/Util.hs` ("[…] Hashable update"). I | ||
8 | replaced the `Hashable` instances for `Object` and `MetaData` with a single, better | ||
9 | optimized function: | ||
10 | |||
11 | ~~~ {.haskell .numberLines} | ||
12 | objHash :: Applicative f => ObjectGen f -> f Int | ||
13 | -- ^ Two 'ObjectGen's hashes are a first indication of whether they are 'Equivalent' | ||
14 | objHash o = fmap hash $ (,) <$> (Set.toList . (^. mTags) <$> o ^. oMeta) <*> (Map.keys <$> o ^. oContent) | ||
15 | ~~~ | ||
16 | |||
17 | The new implementation allows computation of hashes without calling `generateObject` (that | ||
18 | function is evil — it makes sure the entire `Object` is "in RAM" (it isn´t actually, of | ||
19 | course (because haskell is lazy)—but I have no guarantee of that)). | ||