summaryrefslogtreecommitdiff
path: root/posts/blog-rss.md
diff options
context:
space:
mode:
Diffstat (limited to 'posts/blog-rss.md')
-rw-r--r--posts/blog-rss.md24
1 files changed, 14 insertions, 10 deletions
diff --git a/posts/blog-rss.md b/posts/blog-rss.md
index f7dbe37..4e8cb24 100644
--- a/posts/blog-rss.md
+++ b/posts/blog-rss.md
@@ -16,20 +16,24 @@ Each item carries a title, an url, a date, and contents as follows:
16 16
17Along the way two helper functions were introduced — if an implementation of those already exists in Prelude or somewhere else common please mail in a comment: 17Along the way two helper functions were introduced — if an implementation of those already exists in Prelude or somewhere else common please mail in a comment:
18 18
19 (<->) :: [(a -> b)] -> a -> [b] 19~~~ {.haskell}
20 [] <-> _ = [] 20(<->) :: [(a -> b)] -> a -> [b]
21 (f:fs) <-> x = (f x:fs <-> x) 21[] <-> _ = []
22(f:fs) <-> x = (f x:fs <-> x)
22 23
23 (<-->) :: [(a -> a)] -> a -> a 24(<-->) :: [(a -> a)] -> a -> a
24 [] <--> x = x 25[] <--> x = x
25 (f:fs) <--> x = fs <--> (f x) 26(f:fs) <--> x = fs <--> (f x)
27~~~
26 28
27## Update ## 29## Update ##
28 30
29 import Control.Applicative ((<*>), pure) 31~~~ {.haskell}
32import Control.Applicative ((<*>), pure)
30 33
31 (<->) fs = (<*>) fs . pure 34(<->) fs = (<*>) fs . pure
32 35
33 (<-->) = flip $ foldl (.) id 36(<-->) = flip $ foldl (.) id
37~~~
34 38
35Thanks, viktor. \ No newline at end of file 39Thanks, viktor.