Closed dogwith1eye closed 7 years ago
It seems the mustache file was mostly fine, but the initialiser not.
It was out of date on the available adapters and also it would never add import the module for the concrete adapter.
Can you build marvin from source on your machine?
Nearly, this is what happens when compiling marvin-pp
[1 of 1] Compiling Main ( preprocessor/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/marvin-pp/marvin-pp-tmp/Main.o
)
Ah, yes. that is a problem caused by the new linker in OSX. If you use GHC 8.0.2 it should resolve the problem.
For me there was also a problem with the irc-conduit library, which the author was nice enough to fix.
This stack.yaml works for me again:
resolver: lts-8.3
extra-deps:
- marvin-interpolate-1.1
- mustache-2.1.2
- wreq-0.5.0.0
- irc-conduit-0.2.2.1
packages:
- '.'
Marvin will also itself be on stack soon and make all this easier.
Oh and i totally forgot to reference this issue in 1335dabe2c093c28691d8d36875fe12a47cbcdd1
Yep build for me now. The MyScript.hs file still requires a few changes in order for it to run. I have to add...
import Prelude so that ($) function is found
and I have to comment out the line of logging --infoM (content msg) -- logging
Would be nice if the MyScript.hs file ran without any changes.
I should have fixed that. If you run stack install
, in the marvin repo it should install a version from source.
That should incude the fixed initializer.
I also added an integration test to make sure it produces something which compiles without modification.
Here is a quick rundown of what I had to get to get a chatbot example up and working on a slack channel.
marvin-init HelloWorld stack init stack setup
changed resolver back to resolver: nightly-2017-02-19
stack install text-icu \ --extra-lib-dirs=/usr/local/opt/icu4c/lib \ --extra-include-dirs=/usr/local/opt/icu4c/include
stack install
{-# LANGUAGE TemplateHaskell #-} module MyScript where
import Prelude import Marvin.Prelude import Marvin.Adapter.Slack.RTM
script :: ScriptInit (SlackAdapter RTM) script = defineScript "my-script" $ do hear (r [CaseInsensitive] "ping") $ do -- react to any message msg <- getMessage -- read the message contents logInfoN $(isT "#{msg}") send "Pong" -- sending messages back respond "hello" $ do -- react to direct commands reply "Hello to you too"
stack build
Looks like the mustache file needs to be updated