git.iko.soy/typeable/mandrill
on 54e3320 help sign in
6 files changed+9−19
since splitsnapshots
unifiedsplit
.gitignore−1 README.md−4 mandrill.cabal+2−1 src/Network/API/Mandrill.hs+6−7 src/Network/API/Mandrill/Types.hs−5 stack.yaml+1−1
.gitignore−1
@@ -3,4 +3,3 @@ dist
33cabal.sandbox.config
44shell.nix
55.stack-work
6−tags
README.md−4
@@ -8,10 +8,6 @@ the [Mandrill](http://mandrillapp.com) transactional email service.
88
99# Changelog
1010
11−## Version 0.5.3.5
12−
13−* Replaced dependency on lens with microlens (Courtesy of @tom-bop)
14−
1511## Version 0.5.3.3
1612
1713* Relaxed upper bound on Aeson (see: fpco/stackage/issues/3337)
mandrill.cabal+2−1
@@ -41,7 +41,8 @@ library
4141 , http-types >= 0.8.0
4242 , http-client >= 0.3.0
4343 , http-client-tls >= 0.2.0.0
44− , aeson >= 0.7.0.3 && < 1.5.0.0
44+ , aeson >= 0.7.0.3 && < 1.4.0.0
45+ , microlens >= 0.4.0.1
4546 , microlens-th >= 0.4.0.0
4647 , blaze-html >= 0.5.0.0
4748 , QuickCheck >= 2.6 && < 3.0
src/Network/API/Mandrill.hs+6−7
@@ -26,6 +26,7 @@ import qualified Data.HashMap.Strict as H
2626import Data.Monoid
2727import qualified Data.Text as T
2828import Data.Time
29+import Lens.Micro
2930import Network.API.Mandrill.Messages as M
3031import Network.API.Mandrill.Messages.Types as M
3132import Network.API.Mandrill.Trans as M
@@ -106,7 +107,7 @@ newHtmlMessage :: EmailAddress
106107 -- ^ The HTML body
107108 -> MandrillMessage
108109newHtmlMessage f t subj html = let body = mkMandrillHtml html in
109− (emptyMessage f t) { _mmsg_html = body, _mmsg_subject = subj }
110+ ((mmsg_html .~ body) . (mmsg_subject .~ subj)) $ (emptyMessage f t)
110111
111112--------------------------------------------------------------------------------
112113-- | Create a new template message (no HTML).
@@ -117,7 +118,7 @@ newTemplateMessage :: EmailAddress
117118 -> T.Text
118119 -- ^ Subject
119120 -> MandrillMessage
120−newTemplateMessage f t subj = (emptyMessage f t) { _mmsg_subject = subj }
121+newTemplateMessage f t subj = (mmsg_subject .~ subj) $ (emptyMessage f t)
121122
122123--------------------------------------------------------------------------------
123124-- | Create a new textual message. By default Mandrill doesn't require you
@@ -133,11 +134,9 @@ newTextMessage :: EmailAddress
133134 -- ^ The body, as normal text.
134135 -> MandrillMessage
135136newTextMessage f t subj txt = let body = unsafeMkMandrillHtml txt in
136− (emptyMessage f t) {
137− _mmsg_html = body
138− , _mmsg_text = Just txt
139− , _mmsg_subject = subj
140− }
137+ ((mmsg_html .~ body) .
138+ (mmsg_text .~ Just txt) .
139+ (mmsg_subject .~ subj)) (emptyMessage f t)
141140
142141
143142--------------------------------------------------------------------------------
src/Network/API/Mandrill/Types.hs−5
@@ -158,11 +158,6 @@ unsafeMkMandrillHtml = MandrillHtml . Blaze.preEscapedToHtml
158158mkMandrillHtml :: Blaze.Html -> MandrillHtml
159159mkMandrillHtml = MandrillHtml
160160
161−#if MIN_VERSION_base(4,11,0)
162−instance Semigroup MandrillHtml where
163− MandrillHtml m1 <> MandrillHtml m2 = MandrillHtml (m1 <> m2)
164−#endif
165−
166161instance Monoid MandrillHtml where
167162 mempty = MandrillHtml mempty
168163 mappend (MandrillHtml m1) (MandrillHtml m2) = MandrillHtml (m1 <> m2)
stack.yaml+1−1
@@ -2,4 +2,4 @@ flags: {}
22packages:
33- '.'
44extra-deps: []
5−resolver: lts-11.13
5+resolver: lts-5.2