git.iko.soy/typeable/mandrill
on master help sign in
Don't use microlens operators (#50)

* Switch from 'lens' to 'microlens' * Remove Lens.Micro usage (only keep Lens.Micro.TH for 'makeLenses') * Remove unneeded direct dependency on 'microlens' * Version bump (0.5.3.4 is taken on Hackage) * Add an entry to the changelog for 'microlens' dependency

commit1be485bf161d0cb226ebfa26a44c3089bab957db authortom-bop <tom@tinybop.com> dateSat 1 Sep 2018, 05:47 (8 years ago) parent99446a9
3 files changed+11−7
README.md+4 mandrill.cabal−1 src/Network/API/Mandrill.hs+7−6
README.md+4
@@ -8,6 +8,10 @@ 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+
1115## Version 0.5.3.3
1216
1317* Relaxed upper bound on Aeson (see: fpco/stackage/issues/3337)
mandrill.cabal−1
@@ -42,7 +42,6 @@ library
4242 , http-client >= 0.3.0
4343 , http-client-tls >= 0.2.0.0
4444 , aeson >= 0.7.0.3 && < 1.4.0.0
45− , microlens >= 0.4.0.1
4645 , microlens-th >= 0.4.0.0
4746 , blaze-html >= 0.5.0.0
4847 , QuickCheck >= 2.6 && < 3.0
src/Network/API/Mandrill.hs+7−6
@@ -26,7 +26,6 @@ import qualified Data.HashMap.Strict as H
2626import Data.Monoid
2727import qualified Data.Text as T
2828import Data.Time
29−import Lens.Micro
3029import Network.API.Mandrill.Messages as M
3130import Network.API.Mandrill.Messages.Types as M
3231import Network.API.Mandrill.Trans as M
@@ -107,7 +106,7 @@ newHtmlMessage :: EmailAddress
107106 -- ^ The HTML body
108107 -> MandrillMessage
109108newHtmlMessage f t subj html = let body = mkMandrillHtml html in
110− ((mmsg_html .~ body) . (mmsg_subject .~ subj)) $ (emptyMessage f t)
109+ (emptyMessage f t) { _mmsg_html = body, _mmsg_subject = subj }
111110
112111--------------------------------------------------------------------------------
113112-- | Create a new template message (no HTML).
@@ -118,7 +117,7 @@ newTemplateMessage :: EmailAddress
118117 -> T.Text
119118 -- ^ Subject
120119 -> MandrillMessage
121−newTemplateMessage f t subj = (mmsg_subject .~ subj) $ (emptyMessage f t)
120+newTemplateMessage f t subj = (emptyMessage f t) { _mmsg_subject = subj }
122121
123122--------------------------------------------------------------------------------
124123-- | Create a new textual message. By default Mandrill doesn't require you
@@ -134,9 +133,11 @@ newTextMessage :: EmailAddress
134133 -- ^ The body, as normal text.
135134 -> MandrillMessage
136135newTextMessage f t subj txt = let body = unsafeMkMandrillHtml txt in
137− ((mmsg_html .~ body) .
138− (mmsg_text .~ Just txt) .
139− (mmsg_subject .~ subj)) (emptyMessage f t)
136+ (emptyMessage f t) {
137+ _mmsg_html = body
138+ , _mmsg_text = Just txt
139+ , _mmsg_subject = subj
140+ }
140141
141142
142143--------------------------------------------------------------------------------