<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sorbot, branch master</title>
<subtitle></subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/'/>
<entry>
<title>Lib: Test help output with FR locale</title>
<updated>2017-11-19T18:41:25+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-11-19T18:41:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=75c7b2391ef32fab00477a24c259f3772fcc57f5'/>
<id>75c7b2391ef32fab00477a24c259f3772fcc57f5</id>
<content type='text'>
Check that translation and the `ReaderT` really do work by changing
localisation of the STDOUT "help" output from `EN` to `FR`.

To actually test this, add a french translation of the `GitHubCommit`
plugin description. This string is successfully output by the "help"
plugin.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check that translation and the `ReaderT` really do work by changing
localisation of the STDOUT "help" output from `EN` to `FR`.

To actually test this, add a french translation of the `GitHubCommit`
plugin description. This string is successfully output by the "help"
plugin.
</pre>
</div>
</content>
</entry>
<entry>
<title>Lib: Test application of Bot reader</title>
<updated>2017-11-19T18:34:56+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-11-19T18:22:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=6961ef49cbcb88e4f3466a5852a4cf90d95a587a'/>
<id>6961ef49cbcb88e4f3466a5852a4cf90d95a587a</id>
<content type='text'>
A test to try to get _something_ to compile. And it does!

Here we try to run a plugin with `runReaderT` and `runBot` to pass
`Options` to the plugin, using the "help" plugin as an example. It feeds
hard-coded `Options` to the plugin and outputs its response to STDOUT.

Also get an implementation of `initializePlugins` working that will
allow us to build a list of plugins with `Options` applied to the
reader.

This commit comments out the whole of IRC.hs in order to get the code to
compile. That file still has a bunch of `Bot` monad-related type errors.

To build the final plugin list, I think what we'll want to do is use
something like `initializePlugins` in Lib to apply all our plugins with
the `Options` and then feed that to `connectIRC`. In order to build the
"help" plugin, the plan is to re-apply the `Options` after `ask`ing for
them inside the `PluginAction` for "help" to all plugins, thus enabling
us to get a plugin list with the applied reader for proper localisation
of the help output.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A test to try to get _something_ to compile. And it does!

Here we try to run a plugin with `runReaderT` and `runBot` to pass
`Options` to the plugin, using the "help" plugin as an example. It feeds
hard-coded `Options` to the plugin and outputs its response to STDOUT.

Also get an implementation of `initializePlugins` working that will
allow us to build a list of plugins with `Options` applied to the
reader.

This commit comments out the whole of IRC.hs in order to get the code to
compile. That file still has a bunch of `Bot` monad-related type errors.

To build the final plugin list, I think what we'll want to do is use
something like `initializePlugins` in Lib to apply all our plugins with
the `Options` and then feed that to `connectIRC`. In order to build the
"help" plugin, the plan is to re-apply the `Options` after `ask`ing for
them inside the `PluginAction` for "help" to all plugins, thus enabling
us to get a plugin list with the applied reader for proper localisation
of the help output.
</pre>
</div>
</content>
</entry>
<entry>
<title>Bot(privmsgFromPlugin): Try to use the `Bot` monad instead of `IO`</title>
<updated>2017-11-19T18:31:52+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-11-04T02:00:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=eb732a97b82f9d03f68247d79301ee26b84b650b'/>
<id>eb732a97b82f9d03f68247d79301ee26b84b650b</id>
<content type='text'>
Convert this function and `Plugins(performPlugin)` to use a
`Bot`-wrapped plugin.

Still having a lot of trouble with this, unable to get past
monad-related compilation errors. The plan is to leave this as-is for
now and attack the problem from a different place, looking at the `main`
function next, applying our plugins with `runBot`, and then passing
those monad-wrapped plugins to `connectIRC`. Once that's taken care of,
we'll see what we need to modify in this middle strata of the stack.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert this function and `Plugins(performPlugin)` to use a
`Bot`-wrapped plugin.

Still having a lot of trouble with this, unable to get past
monad-related compilation errors. The plan is to leave this as-is for
now and attack the problem from a different place, looking at the `main`
function next, applying our plugins with `runBot`, and then passing
those monad-wrapped plugins to `connectIRC`. Once that's taken care of,
we'll see what we need to modify in this middle strata of the stack.
</pre>
</div>
</content>
</entry>
<entry>
<title>Plugin(matchPlugin): Get our functions to actually work with `Bot`</title>
<updated>2017-09-19T02:58:26+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-19T02:52:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=affb573718b28e2df9f5c5f10fb7a1fff434495e'/>
<id>affb573718b28e2df9f5c5f10fb7a1fff434495e</id>
<content type='text'>
Previously we added the `Bot` monad to our signature, but we didn't have
a way to filter and match plugins wrapped in the `Bot` monad. This is
what we're doing here. It's the same work as before, but we need to
account for a wrapped `Plugin` type.

There's a lot of extra cruft code here from when I was trying things out
to get it working. The short story is that I do some binding and
sequencing dances to extract `Plugin`s so that we can actually match
against them.

I've seen recommendations against `fail`, which is why I tried to use
`mzero`, but it just seemed to be too complicated so went with `fail`,
which seems to make sense in context.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously we added the `Bot` monad to our signature, but we didn't have
a way to filter and match plugins wrapped in the `Bot` monad. This is
what we're doing here. It's the same work as before, but we need to
account for a wrapped `Plugin` type.

There's a lot of extra cruft code here from when I was trying things out
to get it working. The short story is that I do some binding and
sequencing dances to extract `Plugin`s so that we can actually match
against them.

I've seen recommendations against `fail`, which is why I tried to use
`mzero`, but it just seemed to be too complicated so went with `fail`,
which seems to make sense in context.
</pre>
</div>
</content>
</entry>
<entry>
<title>Plugin: Update plugin list with new wrapped `Bot` type</title>
<updated>2017-09-15T21:10:47+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-15T20:42:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=e689b4b8cbf1c73f04b1b348fd0d598d401085b1'/>
<id>e689b4b8cbf1c73f04b1b348fd0d598d401085b1</id>
<content type='text'>
Since our plugins are now wrapped in the `Bot` monad, the plugin list's
type needs to change.

Also update `matchPlugin` to return a `Bot Plugin`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since our plugins are now wrapped in the `Bot` monad, the plugin list's
type needs to change.

Also update `matchPlugin` to return a `Bot Plugin`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Help: Fix type error resulting from new plugin list type with `Bot`</title>
<updated>2017-09-14T20:45:35+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-14T20:45:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=1f9c9d43ef475167ac6e886a71a782cf41bd549e'/>
<id>1f9c9d43ef475167ac6e886a71a782cf41bd549e</id>
<content type='text'>
The plugin list's type has changed from `[Plugin]` to `[Bot Plugin]`. In
order for our code here to work, we need to unwrap the `Bot` part so we
can get access to the `Plugin` again and do the same work.

Fortunately, using `sequence`, we can turn our `[Bot Plugin]` into a
`Bot [Plugin]`, which is then easily bound with `&lt;-` and passed to our
old code to be handled like before. Yay!
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The plugin list's type has changed from `[Plugin]` to `[Bot Plugin]`. In
order for our code here to work, we need to unwrap the `Bot` part so we
can get access to the `Plugin` again and do the same work.

Fortunately, using `sequence`, we can turn our `[Bot Plugin]` into a
`Bot [Plugin]`, which is then easily bound with `&lt;-` and passed to our
old code to be handled like before. Yay!
</pre>
</div>
</content>
</entry>
<entry>
<title>Add `Bot` to rest of plugins</title>
<updated>2017-09-14T01:44:38+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-14T01:44:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=ea190de02cea99347ae125d86cc22bf8cd926c88'/>
<id>ea190de02cea99347ae125d86cc22bf8cd926c88</id>
<content type='text'>
Add our `Bot` monad to the rest of the plugins:

* Factorial
* GitRemoteSetOrigin
* Help

The only problem is with the Help plugin. Still trying to figure out how
to set up my list comprehension so that it works with the `Bot`-wrapped
`Plugin` list.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add our `Bot` monad to the rest of the plugins:

* Factorial
* GitRemoteSetOrigin
* Help

The only problem is with the Help plugin. Still trying to figure out how
to set up my list comprehension so that it works with the `Bot`-wrapped
`Plugin` list.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Config</title>
<updated>2017-09-13T02:47:08+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-10T22:57:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=cd366dc004b82f0ea937da231cbc1c9abfdca934'/>
<id>cd366dc004b82f0ea937da231cbc1c9abfdca934</id>
<content type='text'>
An old config object, from before I decided to go with the `Bot` type.
Committed here just to show some of the process. We'll be removing it
soon.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An old config object, from before I decided to go with the `Bot` type.
Committed here just to show some of the process. We'll be removing it
soon.
</pre>
</div>
</content>
</entry>
<entry>
<title>gitHubCommit: Fix type error</title>
<updated>2017-09-13T02:47:08+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-10T22:53:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=ae6949327ed8bd8cfa528da7741333274203af44'/>
<id>ae6949327ed8bd8cfa528da7741333274203af44</id>
<content type='text'>
Oh my goodness, it works!!!!!!! I've been wrestling with this for the
past week and a half, and it finally works!

Here's the compiler error I was getting:

    sorbot/src/Plugin/GitHubCommit.hs:25:12: error:
        • Couldn't match type ‘Control.Monad.Trans.Reader.ReaderT r0 m1’
                         with ‘Bot’
          Expected type: Bot t0
            Actual type: Control.Monad.Trans.Reader.ReaderT r0 m1 t0
        • In a stmt of a 'do' block: cfg &lt;- asks language
          In the expression:
            do { cfg &lt;- asks language;
                 return
                   (defaultPlugin
                      {matchRegex = "^[0-9a-f]{40}$", perform = gitHubCommitAction,
                       command = "&lt;git_sha&gt;",
                       description = translate (lang cfg) GitHubCommitDescription}) }
          In an equation for ‘gitHubCommit’:
              gitHubCommit
                = do { cfg &lt;- asks language;
                       return
                         (defaultPlugin
                            {matchRegex = "^[0-9a-f]{40}$", perform = gitHubCommitAction,
                             command = "&lt;git_sha&gt;",
                             description = translate (lang cfg) GitHubCommitDescription}) }

The problem ended up being that I was using the wrong `ask` &amp; `asks`
functions. After a lot of searching online and reading articles and
things about how to set up `ReaderT` configuration, I finally started
looking at some code, from a "language:Haskell newtype app readert"
search on GitHub. Reading different code bits, I tried to compare with
what I had already, kept reading. Finally I noticed that the imports
were different, and I tried getting `ask` not from the transformer
library, and it worked!! OMG! So glad.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Oh my goodness, it works!!!!!!! I've been wrestling with this for the
past week and a half, and it finally works!

Here's the compiler error I was getting:

    sorbot/src/Plugin/GitHubCommit.hs:25:12: error:
        • Couldn't match type ‘Control.Monad.Trans.Reader.ReaderT r0 m1’
                         with ‘Bot’
          Expected type: Bot t0
            Actual type: Control.Monad.Trans.Reader.ReaderT r0 m1 t0
        • In a stmt of a 'do' block: cfg &lt;- asks language
          In the expression:
            do { cfg &lt;- asks language;
                 return
                   (defaultPlugin
                      {matchRegex = "^[0-9a-f]{40}$", perform = gitHubCommitAction,
                       command = "&lt;git_sha&gt;",
                       description = translate (lang cfg) GitHubCommitDescription}) }
          In an equation for ‘gitHubCommit’:
              gitHubCommit
                = do { cfg &lt;- asks language;
                       return
                         (defaultPlugin
                            {matchRegex = "^[0-9a-f]{40}$", perform = gitHubCommitAction,
                             command = "&lt;git_sha&gt;",
                             description = translate (lang cfg) GitHubCommitDescription}) }

The problem ended up being that I was using the wrong `ask` &amp; `asks`
functions. After a lot of searching online and reading articles and
things about how to set up `ReaderT` configuration, I finally started
looking at some code, from a "language:Haskell newtype app readert"
search on GitHub. Reading different code bits, I tried to compare with
what I had already, kept reading. Finally I noticed that the imports
were different, and I tried getting `ask` not from the transformer
library, and it worked!! OMG! So glad.
</pre>
</div>
</content>
</entry>
<entry>
<title>GitHubCommit: Use `Cli.language` to get language</title>
<updated>2017-09-13T02:47:08+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-10T22:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/sorbot/commit/?id=515de5dd5d44fb361fe7ca68d698776e84c4d523'/>
<id>515de5dd5d44fb361fe7ca68d698776e84c4d523</id>
<content type='text'>
Since we're trying to get the language from an `Options` type in the
reader, we need to use the `language` helper instead of our custom
`lang` (which operates on `IO`).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since we're trying to get the language from an `Options` type in the
reader, we need to use the `language` helper instead of our custom
`lang` (which operates on `IO`).
</pre>
</div>
</content>
</entry>
</feed>
