Skip to content

Commit 436ee20

Browse files
authored
Use hakyll-shortcut-links library (#32)
1 parent 440ceae commit 436ee20

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

blog/2019-03-20-write-yourself-a-lens.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ our users. This brings us to the decision of implementing our own lenses inside
4040
### How it should work
4141

4242
`relude` encourages users enthusiasm and eagerness to explore. That’s why
43-
`relude` uses the approach with the [`Extra.*` modules](https://github.com/kowainik/relude/tree/master/src/Relude/Extra) which
43+
`relude` uses the approach with the [`Extra.*` modules](@github(kowainik):relude/tree/master/src/Relude/Extra) which
4444
are not exported by default, so it is quite easy to bring something new and let
4545
users decide whether to use it or not without spoiling the global namespace.
4646
This method is also applied to the implementation of `lens`. To use lenses from
@@ -175,7 +175,7 @@ the one that suits us the most. Okay, we actually need the functor that won't
175175
change the object at all and will just return a value. Let's look at the
176176
standard [Functor instances in the base library][functor] to choose the most
177177
suitable instance. Recall, that we are implementing the getter, so name
178-
[`Const`](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Functor-Const.html#t:Const)
178+
[`Const`](@hackage:base-4.12.0.0/docs/Data-Functor-Const.html#t:Const)
179179
sounds good in these conditions. Let's check it out:
180180

181181
```haskell
@@ -210,7 +210,7 @@ know that it is all about choosing the correct functor. This time we actually
210210
want to change the value inside the functor and to return the whole data not
211211
wrapped into anything. Let's check [the list][functor] again. Aha, look what I
212212
found:
213-
[Identity](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Functor-Identity.html#t:Identity)
213+
[Identity](@hackage:base-4.12.0.0/docs/Data-Functor-Identity.html#t:Identity)
214214

215215

216216
```haskell
@@ -233,7 +233,7 @@ But wait, we are not using a variable with name `a` at all! This is suspicious,
233233
taking into consideration the goal that this function is pursuing. We want the
234234
value of the type `a` to be changed to the given one. So we need to somehow
235235
change the `a` value, no matter what the value it had before. Sounds like the
236-
[`const`](https://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#v:const)
236+
[`const`](@hackage:base-4.12.0.0/docs/Prelude.html#v:const)
237237
function:
238238

239239
```haskell
@@ -393,7 +393,7 @@ Haskeller { haskellerName = "vrom911", ... }
393393
```
394394

395395
To give the context of how it works, check out the type of
396-
[`&`](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Function.html#v:-38-)
396+
[`&`](@hackage:base-4.12.0.0/docs/Data-Function.html#v:-38-)
397397
operator:
398398

399399

@@ -445,11 +445,11 @@ you & kLensL .~ True
445445

446446
As promised, some links:
447447

448-
* [relude: Lens Hackage page](https://hackage.haskell.org/package/relude-0.5.0/docs/Relude-Extra-Lens.html)
449-
* [relude: Lens source code](https://github.com/kowainik/relude/blob/master/src/Relude/Extra/Lens.hs)
448+
* [relude: Lens Hackage page](@hackage:relude-0.5.0/docs/Relude-Extra-Lens.html)
449+
* [relude: Lens source code](@github(kowainik):relude/blob/master/src/Relude/Extra/Lens.hs)
450450
* [`lens` package][lens]
451-
* [`microlens` package](http://hackage.haskell.org/package/microlens)
452-
* [lens tutorial](http://hackage.haskell.org/package/lens-tutorial-1.0.3/docs/Control-Lens-Tutorial.html)
451+
* [`microlens` package](@hackage:microlens)
452+
* [lens tutorial](@hackage:lens-tutorial-1.0.3/docs/Control-Lens-Tutorial.html)
453453
* [School of Haskell lens tutorial](https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/a-little-lens-starter-tutorial)
454454
* [Wiki Lenses](https://en.wikibooks.org/wiki/Haskell/Lenses_and_functional_references)
455455
* [Lens over tea](https://artyom.me/lens-over-tea-1)

src/Website/Blog.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import Data.List (nub)
1111
import Hakyll (Compiler, Context, Item, Pattern, Rules, buildTags, compile, constField, create,
1212
customRoute, defaultContext, defaultHakyllReaderOptions, defaultHakyllWriterOptions,
1313
field, fromCapture, getResourceString, getTags, idRoute, itemBody, itemIdentifier,
14-
listField, loadAll, loadAndApplyTemplate, makeItem, match, pandocCompiler,
15-
recentFirst, relativizeUrls, renderPandocWith, route, tagsRules, toFilePath)
14+
listField, loadAll, loadAndApplyTemplate, makeItem, match, recentFirst,
15+
relativizeUrls, renderPandocWith, route, tagsRules, toFilePath)
16+
import Hakyll.ShortcutLinks (allShortcutLinksCompiler)
1617
import System.FilePath (replaceExtension)
1718
import Text.Pandoc.Options (WriterOptions (..))
1819

@@ -33,7 +34,7 @@ matchBlogPosts = match "blog/*" $ do
3334
let postTagsCtx = postCtxWithTags tgs
3435
<> mkPostSocialCtx
3536
<> constField "toc" toc
36-
pandocCompiler
37+
allShortcutLinksCompiler
3738
>>= loadAndApplyTemplate "templates/post.html" postTagsCtx
3839
>>= relativizeUrls
3940

website.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ library
3434
build-depends: base ^>= 4.12
3535
, filepath ^>= 1.4
3636
, hakyll ^>= 4.12
37+
, hakyll-shortcut-links ^>= 0.0.0.0
3738
, pandoc >= 2.6
3839
, text
3940

0 commit comments

Comments
 (0)