From 42c0849549032ca665c165ca7ffb19bb59692431 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 7 Apr 2015 19:34:18 +0200 Subject: Syntax highlighting in source listings --- posts/blog-rss.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'posts/blog-rss.md') 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: Along 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: - (<->) :: [(a -> b)] -> a -> [b] - [] <-> _ = [] - (f:fs) <-> x = (f x:fs <-> x) +~~~ {.haskell} +(<->) :: [(a -> b)] -> a -> [b] +[] <-> _ = [] +(f:fs) <-> x = (f x:fs <-> x) - (<-->) :: [(a -> a)] -> a -> a - [] <--> x = x - (f:fs) <--> x = fs <--> (f x) +(<-->) :: [(a -> a)] -> a -> a +[] <--> x = x +(f:fs) <--> x = fs <--> (f x) +~~~ ## Update ## - import Control.Applicative ((<*>), pure) +~~~ {.haskell} +import Control.Applicative ((<*>), pure) - (<->) fs = (<*>) fs . pure +(<->) fs = (<*>) fs . pure - (<-->) = flip $ foldl (.) id +(<-->) = flip $ foldl (.) id +~~~ -Thanks, viktor. \ No newline at end of file +Thanks, viktor. -- cgit v1.2.3