This commit is contained in:
Nox Sluijtman 2023-03-24 22:05:38 +01:00
parent 71dea08d40
commit 9d080f7cb5

View file

@ -67,7 +67,7 @@ Seems easy enough to implement.
### Parsing the Bookmarks file
Lets start off by creating a function that can parse our bookmarks file. Here we
Let's start off by creating a function that can parse our bookmarks file. Here we
need something to read a file -- in this case a bookmarks file -- and return its
contents in the form of a list of strings.
@ -88,7 +88,7 @@ fileContentList f = do
return . uniqSort . lines $ file
```
Lets go over what is happening here line by line.
Let's go over what is happening here line by line.
`fileContentList` is a function that takes an argument `f`; then it starts a
`do` block. `do` blocks are used to put multiple functions in sequence in the
@ -125,7 +125,7 @@ And the output of that is piped into `return`:
return . uniqSort . lines $ file
```
This function will allows us to parse any given text file. To parse the
This function will allow us to parse any given text file. To parse the
Qutebrowser bookmarks file, call it using `.config/qutebrowser/bookmarks/url`
> _Note_: I say "pipe" because the '`.`' function behaves quite similar to
@ -137,7 +137,7 @@ Qutebrowser bookmarks file, call it using `.config/qutebrowser/bookmarks/url`
### Creating a Prompt
Lets see if there is anything in the
Let's see if there is anything in the
[`XMonad.Prompt`](https://hackage.haskell.org/package/xmonad-contrib-0.17.1/docs/XMonad-Prompt.html)
module that looks like it could help us in creating a prompt.
@ -154,7 +154,7 @@ module that looks like it could help us in creating a prompt.
This looks like it could serve as the basis for our prompt. The description and
type signature tell us that it is going to require an instance of the `XPrompt`
typeclass. So lets create a `Bookmark` datatype and implement the `showXPrompt`
typeclass. So let's create a `Bookmark` datatype and implement the `showXPrompt`
function from `XPrompt` in order to give it a default message when executed and
thereby having it derive from `XPrompt`.
@ -178,7 +178,7 @@ bookmarkPrompt c = do
This takes care of the `XPrompt p => p -> XPConfig` portion of the function.
Now for the completion function, that will handle the list given to our prompt.
Lets mostly follow the suggestion in the description of `mkXPrompt` and lets
Let's mostly follow the suggestion in the description of `mkXPrompt` and lets
take a look at:
> ```haskell
@ -225,7 +225,7 @@ openBookmark bookmark = do
```
`openBookmark` is a function that takes a string and returns something in the
context of the `X` monad (hence the name "XMonad", it's a monad that interacts
with Xorg). Lets go through it line by line.
with Xorg). Let's go through it line by line.
```haskell
browser <- io getBrowser